Getting "interval is empty" when 2nd argument is greater than the 1st argument

Hi. I am having trouble using math.random. I know that you get interval is empty when your 2nd argument is less than your 1st argument, but my 2nd argument is greater than the 1st argument. So, I’m here confused.

Code :

local thing = math.random(2000000000, 4000000000)

Thanks, Vaelkarr.

1 Like

Just wondering, why do you need to get a random number from two billion to four billion? Anyway, math.random could have limitations, so I’d try using lower integers and see if you still get interval is empty, preferably under 2^31-1.

Thanks, sorry for the 5m long reply.

you could use scientific notation in this inference…

local thing = math.random(math.20.00000000, 40.00000000)
thing = thing * 10^8

Or use the “classic” implementation of the random function

local min = 2e9
local max = 4e9
local thing = math.floor(math.random() * (max - min) + min)