Created
January 3, 2020 06:07
-
-
Save cuixin/9205143d82c68c70a5db83418bfc0354 to your computer and use it in GitHub Desktop.
generate lua safe random numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i = 1, 10000 do | |
local t = os.time() | |
local c = os.clock() | |
local seed = t + (c*1000000) | |
math.randomseed(seed) | |
print(t, c, seed, math.random(1, 2147483647)) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment