Darwinbots Forum

Bots and Simulations => DNA - General => Topic started by: Light on February 26, 2005, 11:48:24 AM

Title: Randomness
Post by: Light on February 26, 2005, 11:48:24 AM
I want to get a random number between say -20 and 20, I thought

20 rnd 40 rnd sub

but this doesn't seem to work, am I being a bit dense?
Title: Randomness
Post by: PurpleYouko on February 26, 2005, 12:06:41 PM
Try changing it around a bit.

You have a total range of 40 from -20 to +20 so you need to start out with...

40 rnd

Next you want to take away 20 to centre the result around zero...

40 rnd 20 sub

This won't be perfect as the exact middle is -0.5 but it is close enough

 :D  PY  :D
Title: Randomness
Post by: Light on February 26, 2005, 12:39:06 PM
of course thanks PY  :)