Page 2 of 2

Re: bad argument #1 to 'random' (interval is empty)?!?!?

Posted: Tue Feb 08, 2011 5:57 pm
by Robin
miko wrote:If you want to get a random number between -10 and 10 do something like this:

Code: Select all

value=math.random(0,20)-10
or

Code: Select all

value=math.random(-10,10)
Just remember,

Code: Select all

value=math.random(-20)
is the same as

Code: Select all

value=math.random(1,-20)
which gives an error, because there are no numbers >= 1 and <= -20.