Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

math.random() limit with large numbers?

I'm currently creating a game and I have to deal with very large numbers. I was trying to find a random number between these large numbers using math.random(). I found that it would return 0 if you have extremely large numbers in the arguments. Is there any way to fix this problem? Any help would be appreciated.

Code

local Random = math.random(1e22, 1e24)

print(Random)

This would print 0 in the output.

1 comment

1

What is the reason to use these giant numbers? more than likely, you can use a static multiplier to make small numbers much larger (like scientific notation)

1 answer

The highest number you can get in Roblox is i'm pretty sure math.huge and its a pretty big number. Just do math.random(math.huge) it gives u a random number from 1, math.huge, which is a big, big number like I said.

This discussion is preserved as it was. New answers, comments, and votes are closed.