Bots and Simulations > DNA - General

Randomness

(1/1)

Light:
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?

PurpleYouko:
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

Light:
of course thanks PY  :)

Navigation

[0] Message Index

Go to full version