math.randomseed(tick())
local rand = math.random(1, 3)
print(rand)
That's it, it prints "3" every time instead of 1, 2, or 3.
math.randomseed(tick())
local rand = math.random(1, 3)
print(rand)
That's it, it prints "3" every time instead of 1, 2, or 3.
See my answer here: https://scriptinghelpers.org/questions/43181/is-it-just-me-or-has-mathrandomseed-stopped-working
Quick answer: always ignore the first math.random(), like so:
math.randomseed(tick())
math.random()
print(math.random(1, 3))
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
I see, did it change or something? I remember it working differently the last time I used it. Thanks by the way.
The need to skip the first math.random() has been in place for years. If you print the first math.random(), you'll find that it is different for different seeds - just not by much.
I recommend using math.randomseed(os.time())
@craftsmashbuild Tick revolves around a user's time zone, while Os.Time revolves around the general time; Tick will still function as is, even if it's not used in a LocalScript if that's what you mean. c;