Random Number Ranges
How do I get a random number somewhere between -5 and +5?
Random x only works for positive numbers and starts at 1. To get a negative number, or a range of numbers that goes below 0, you need to subtract from your positive random number. In order to start your range of random numbers at a positive number greater than 1, you'll need to add to your random number.
Next we want to find a random number in that range and either lift or lower the range by our lowest number.
Submitted by talaya on 6. March 2009 - 23:07