Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

math.random() limit with large numbers?

Asked by 4 years ago

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
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) Internal_1 344 — 4y

1 answer

Log in to vote
3
Answered by
Alphexus 498 Moderation Voter
4 years ago

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.

Ad

Answer this question