Number sequence?
Like XAXA's link in his comment references, this is all dealing with a function called math.randomseed. This functions allows you to set the random number generator sequence of your script environment.
If you're getting the same number over and over again right when your game starts at the exact same time as the last, this is using the same seed over and over again (allegedly).
Seed?
A seed is pretty simple to understand; you could think of it just as a seed for a flower. Different flower seeds grow different flowers. In this case, different number seeds produce different sequences of random numbers.
Implementing this in your code
It's probably ideal when working with math.random, to assign a new random seed at the beginning of your script IF you plan to be working with it as soon as the game launches. If you're using math.random for effects of something, or when a user inputs something, you probably won't have to worry about creating a new seed.
So, what 'seed' should I use?
So here's the thing, obviously to have a different number sequence every time, you'd need a different random seed every time. How can this be done?- Isn't this impossible without using math.random? Not really. All we have to do is think of something that constantly changes, and will never be the same no matter what. Sound familiar? We can use time for this (specifically, tick).
Tick is a function that returns the current UNIX time, and is perfect for setting the new random seed for your script. Here's an example:
math.randomseed(tick())
print(math.random(7))
Try this code, and if you have any problems or questions, just leave a comment and I'll get to it.
3 comments
http://wiki.roblox.com/index.php?title=Random_numbers#Generating_Different_Random_Numbers_Every_Time_the_Game_Runs
Thanks for the help XAXA. But turns out that wasn't quite the issue. The script (i guess) just needed some sort of initialization period before executing "math.random"
Oh, sorry. Answered this before I saw the "Solved" part, lol.