Skip to content

Instantly share code, notes, and snippets.

@cuixin
Created January 3, 2020 06:07
Show Gist options
  • Save cuixin/9205143d82c68c70a5db83418bfc0354 to your computer and use it in GitHub Desktop.
Save cuixin/9205143d82c68c70a5db83418bfc0354 to your computer and use it in GitHub Desktop.
generate lua safe random numbers
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