I dont suppose anyone knows what the proper way of using Rnd in FB is please folks?
In BB you'd use for example:
RandomNumber1=Rand(0,255)
RandomNumber2=Rand(64,120)
At the moment, i've been using in FB things like:
RandomNumber1=int(Rnd*255)
RandomNumber2=int(Rnd(1)*255)
But ive a shrewd suspicion, im using Rnd wrongly.
And hints and tips,
Much appreciated - Clyde
Rafryer Wrote:
Rnd will return a random value between 0.0 and 1.0 so just use:
number=Rnd*maximum
if number is an integer then the result will be 0-maximum inclusive but if it's a single then the result will be 0-(not quite maximum)
in the case of single, Rnd*255.0 will return a value between and including 0.0 and 254.9922 (not sure why it doesnt go all the way to 255)
and if you wanted a random number between 10 and 20 do something like:
number=(Rnd*10.0)+10.0
Shockwave Wrote:
And if you want your random number range to be partly negative, just subtract from the number you generated to pull it into the range you want.