It was working fine a week ago but suddenly today I found it returning the same numbers again.
math.randomseed(os.time())
for i=1,10 do
print(math.random(1,100))
end
I get the same sequence of numbers every time... Is it just me?
Thanks
It was working fine a week ago but suddenly today I found it returning the same numbers again.
math.randomseed(os.time())
for i=1,10 do
print(math.random(1,100))
end
I get the same sequence of numbers every time... Is it just me?
Thanks
Possibilities I can think of:
Ctrl+f for "math.randomseed" in http://lua-users.org/wiki/MathLibraryTutorial; it explains a bit on what's going on and offers a couple things you can do to improve the randomness.
I'll try your third point... I've read the whole article on the wiki a while back so I'm not sure if that's the issue. If it persists then I'll just conclude that the problem lies in the reliability of the random generators in Lua/Roblox
Also I used tick() sometimes for the random seed and it doesn't seem to help much either
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
I kept getting the same sequence of numbers every second of time.
you will get pretty similar results with pretty similar keys