mirror of
https://github.com/lua/lua
synced 2026-09-29 04:35:58 +03:00
'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:
parent
c5feac2b5e
commit
9eca305e75
3 changed files with 36 additions and 20 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue