diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-19 13:31:53 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-19 13:31:53 -0300 |
commit | 2f22c6bb79d209a55b3fc8e0b2d9c9f89f038174 (patch) | |
tree | 9fcece0aa1fa65f52b547c51e3c39181815f0887 /testes | |
parent | 3c0d3c6fbeea18f257102c62a01b036c7a5c5161 (diff) | |
download | lua-2f22c6bb79d209a55b3fc8e0b2d9c9f89f038174.tar.gz lua-2f22c6bb79d209a55b3fc8e0b2d9c9f89f038174.tar.bz2 lua-2f22c6bb79d209a55b3fc8e0b2d9c9f89f038174.zip |
'math.randomseed' always returns the two seed components
Diffstat (limited to 'testes')
-rw-r--r-- | testes/math.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/testes/math.lua b/testes/math.lua index 0c297e74..d0aaa6a5 100644 --- a/testes/math.lua +++ b/testes/math.lua | |||
@@ -842,9 +842,11 @@ end | |||
842 | 842 | ||
843 | do | 843 | do |
844 | -- testing return of 'randomseed' | 844 | -- testing return of 'randomseed' |
845 | local <const> x, <const> y = math.randomseed() | 845 | local x, y = math.randomseed() |
846 | local res = math.random(0) | 846 | local res = math.random(0) |
847 | math.randomseed(x, y) -- should repeat the state | 847 | x, y = math.randomseed(x, y) -- should repeat the state |
848 | assert(math.random(0) == res) | ||
849 | math.randomseed(x, y) -- again should repeat the state | ||
848 | assert(math.random(0) == res) | 850 | assert(math.random(0) == res) |
849 | -- keep the random seed for following tests | 851 | -- keep the random seed for following tests |
850 | end | 852 | end |