'math.randomseed()' sets a somewhat random seed

When called with no arguments, 'math.randomseed' uses time and ASLR
to generate a somewhat random seed. the initial seed when Lua starts
is generated this way.
This commit is contained in:
Roberto Ierusalimschy
2019-03-13 14:47:48 -03:00
parent c5feac2b5e
commit 9eca305e75
3 changed files with 36 additions and 20 deletions

View File

@@ -838,7 +838,7 @@ do
assert(rand * 2^floatbits == res)
end
math.randomseed(0, os.time())
math.randomseed()
do -- test random for floats
local randbits = math.min(floatbits, 64) -- at most 64 random bits