diff options
author | Mike Pall <mike> | 2024-07-04 01:26:29 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2024-07-04 01:26:29 +0200 |
commit | 04dca7911ea255f37be799c18d74c305b921c1a6 (patch) | |
tree | 0979ae369fbb82e7e5fb1c53fcf5cf5955c95f7b /doc | |
parent | 7421a1b33c7ea46f12bba9700c15b5c90253fee0 (diff) | |
download | luajit-04dca7911ea255f37be799c18d74c305b921c1a6.tar.gz luajit-04dca7911ea255f37be799c18d74c305b921c1a6.tar.bz2 luajit-04dca7911ea255f37be799c18d74c305b921c1a6.zip |
Call math.randomseed() without arguments to seed from system entropy.
Reminder: the math.random() PRNG is NOT SUITABLE FOR CRYPTOGRAPHIC USE.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/extensions.html | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/doc/extensions.html b/doc/extensions.html index c1c9a808..e9aaa096 100644 --- a/doc/extensions.html +++ b/doc/extensions.html | |||
@@ -265,7 +265,7 @@ and let the GC do its work. | |||
265 | LuaJIT uses a Tausworthe PRNG with period 2^223 to implement | 265 | LuaJIT uses a Tausworthe PRNG with period 2^223 to implement |
266 | <tt>math.random()</tt> and <tt>math.randomseed()</tt>. The quality of | 266 | <tt>math.random()</tt> and <tt>math.randomseed()</tt>. The quality of |
267 | the PRNG results is much superior compared to the standard Lua | 267 | the PRNG results is much superior compared to the standard Lua |
268 | implementation, which uses the platform-specific ANSI rand(). | 268 | implementation, which uses the platform-specific ANSI <tt>rand()</tt>. |
269 | </p> | 269 | </p> |
270 | <p> | 270 | <p> |
271 | The PRNG generates the same sequences from the same seeds on all | 271 | The PRNG generates the same sequences from the same seeds on all |
@@ -276,6 +276,10 @@ It's correctly scaled up and rounded for <tt>math.random(n [,m])</tt> to | |||
276 | preserve uniformity. | 276 | preserve uniformity. |
277 | </p> | 277 | </p> |
278 | <p> | 278 | <p> |
279 | Call <tt>math.randomseed()</tt> without any arguments to seed it from | ||
280 | system entropy. | ||
281 | </p> | ||
282 | <p> | ||
279 | Important: Neither this nor any other PRNG based on the simplistic | 283 | Important: Neither this nor any other PRNG based on the simplistic |
280 | <tt>math.random()</tt> API is suitable for cryptographic use. | 284 | <tt>math.random()</tt> API is suitable for cryptographic use. |
281 | </p> | 285 | </p> |