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

I have seen this alot but how does math.random work?

I want to make a random number generator but i dont know how to use math.random could someone explain it to me?

1 answer

✓ Accepted answer

math.random is a random number generator, it generates random numbers man!!!

if you want the same random numbers every time you join the game simply do this

math.random(0,100)

As you see the 0,100 is the range... a random number picked from 0 through 100

and there is also if you want different random numbers every time you join the game

math.randomseed(tick())
math.random(0,100)

That randomseed simply ticks and makes sure your math.random is always different per game..

If you want decimal randoms then do this:

math.random(0,100)/10 -- gives decimals.

If this worked, click accept, thanks

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