max = 40;
fromR = 0;
fromG = 255;
fromB = 0;
toR = 255;
toG = 0;
toB = 0;
deltaR = Round((toR - fromR) / max);
deltaG = Round((toG - fromG) / max);
deltaB = Round((toB - fromB) / max);
R = fromR + t * deltaR;
G = fromG + t * deltaG;
B = fromB + t * deltaB;
random()
Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0.
0.0 <= random() < 1.0