Page 1 of 1

rgb

PostPosted: Sat Feb 04, 2006 11:30 am
by Troodon
How can I make this code work?
terminator.r = rand(1*255);
terminator.g = rand(1*255);
terminator.b = rand(1*255);

PostPosted: Sat Feb 04, 2006 11:46 am
by Novice
Code: Select all
terminator.r = round(rand(254))+1;
terminator.g =  round(rand(254))+1;
terminator.b =  round(rand(254))+1;

Use this code if you want to avoid zero.
Code: Select all
terminator.r = round(rand(255));
...

This will get you values from 0 to 255.