Question: Maple is caching results of proc call

RandC := proc(k := getSystemTimeMS())
    local r,b,g,kk;
    kk := k+ parse(convert(Time(), string)[6..18]);
    kk := (randomize(round(k*time[real]() + getSystemTimeMS() + time[real]())));    
    (randomize(round(k*time[real]() + getSystemTimeMS() + time[real]())));    
    r := rand(0..1.0)();
    kk := k+ parse(convert(Time(), string)[6..18]);
    (randomize(round(k*time[real]() + getSystemTimeMS() + time[real]())));    
    kk := (randomize(round(kk*r + k + time[real]() + getSystemTimeMS())));    
    g := rand(0..1.0)();
    kk := k+ parse(convert(Time(), string)[6..18]);
    (randomize(round(k*time[real]() + getSystemTimeMS() + time[real]())));    
    kk := (randomize(round(kk*g + k*r*time[real]() + getSystemTimeMS())));
    b := rand(0..1.0)();
    [RGB(r,g,b)];
end proc:

Been trying to generate random colors but nothing works because obviously maple decides to cache the results if the arguments are the same. If I call RandC with an argument that changes it will give me different values. If not it will sometimes give me different values but usually there will be long strings of the same value.

Hence when I generate a sequence of random colors I will almost always get a sequence of the same color or a sequence that containst the same color many times. I'd like to be able to use RandC without having to provide arguments.

(all the junk in the function was trying to get it to randomize properly as I didnt' realize maple was caching. Also Value(Time()) does not return the ms and seems to do nothing which contradicts the help and hence the parse)

This seems like a dangerous thing for maple to do. Silently caching results that depend on random generation will result in non-random results. It could skew many results.

Please Wait...