'math.randomseed()' returns the seeds it used

A call to 'math.randomseed()' returns the two components of the seed
it set, so that they can be used to set that same seed again.
This commit is contained in:
Roberto Ierusalimschy
2019-07-17 16:00:24 -03:00
parent 9c28ed05c9
commit 4eefef07ab
4 changed files with 27 additions and 7 deletions

View File

@@ -7798,6 +7798,9 @@ The default for @id{y} is zero.
When called with no arguments,
Lua generates a seed with
a weak attempt for randomness.
In this case,
the call returns the two seed components that were used.
To ensure a required level of randomness to the initial state
(or contrarily, to have a deterministic sequence,
for instance when debugging a program),