Author Topic: Randomness  (Read 3410 times)

Offline Light

  • Bot Destroyer
  • ***
  • Posts: 245
    • View Profile
Randomness
« 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?

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Randomness
« Reply #1 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
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Light

  • Bot Destroyer
  • ***
  • Posts: 245
    • View Profile
Randomness
« Reply #2 on: February 26, 2005, 12:39:06 PM »
of course thanks PY  :)