Math.random always the same when starting studio

I have a script in ServerScriptService that says print(math.random()) and I press run. It prints a random number. I press stop, then press run again. It prints the same random number. It always prints the same number.

If I add math.randomseed(os.time()) at the top, it prints a different random number than without the randomseed, but always the same one if I press stop and then run again, regardless of the change in time.

There was a post about this a while ago and it’s something to do with windows threads if I remember correctly.

I’ll edit this if I can find it.

EDIT: Was to do with after delays, so may not be the same bug:

Use tick, not os.time–tick gives you more unique bits to work with. Also, entropy is reset to zero when you call randomseed. Fix that by calling random() several times after every call to randomseed().

This isn’t a bug so much as a quirk with rand and srand from C