Skip to content

Commit 9c5bba0

Browse files
committed
Update documentation of crypto.random
1 parent c9edbae commit 9c5bba0

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

docs/Runtime Environment/Crypto.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -234,17 +234,12 @@ assert(crypto.sha512("Pluto", false) == "ee8410a8bf9511b94fd6669b5c3e0c4b86e8e4b
234234
---
235235
## Cryptographic PRNGs
236236
### `crypto.random`
237-
The `crypto.random` function uses your operating system's default PRNG.
238-
- On Linux-based systems, this is `/dev/urandom`.
239-
- On Windows, this is `BCryptGenRandom`.
240-
241-
This is a cryptographically-secure PRNG when your system can provide those services. However, if it does not, then this is not cryptographically secure. Either way, it provides good randomness.
242-
#### Parameters
243-
1. The minimum value to return.
244-
2. The maximum value to return, as a range.
237+
This is a cryptographically secure PRNG, assuming the platform's implementation of the underlying primitive is secure.
238+
#### Returns
239+
A random lua integer, in the range from `math.mininteger` to `math.maxinteger`.
245240
```pluto
246241
local crypto = require("crypto")
247-
assert(crypto.random(1, 10) < 11)
242+
print(crypto.random())
248243
```
249244

250245
---

0 commit comments

Comments
 (0)