File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -258,11 +258,18 @@ print(crypto.ripemd160("Pluto")) --> c2072a85f4a691803b8942709036072086fd9550
258
258
## Cryptographic PRNGs
259
259
### ` crypto.random `
260
260
This is a cryptographically secure PRNG, assuming the platform's implementation of the underlying primitive is secure.
261
+ #### Parameters
262
+ This function takes 0-2 integer parameters that define the output range:
263
+ - If no arguments are given, an inclusive range from ` math.mininteger ` to ` math.maxinteger ` is used.
264
+ - If 1 argument (` n ` ) is given, an inclusive range from 1 to ` n ` is used.
265
+ - If 2 arguments (` l ` , ` u ` ) are given, an inclusive range from ` l ` to ` u ` is used.
261
266
#### Returns
262
- A random lua integer, in the range from ` math.mininteger ` to ` math.maxinteger ` .
267
+ A random lua integer, in the given range .
263
268
``` pluto
264
269
local crypto = require("crypto")
265
- print(crypto.random())
270
+ print(crypto.random()) -- Prints an integer from math.mininteger to math.maxinteger.
271
+ print(crypto.random(6)) -- Prints an integer from 1 to 6, like a dice roll.
272
+ print(crypto.random(10, 20)) -- Prints an integer from 10 to 20.
266
273
```
267
274
268
275
---
You can’t perform that action at this time.
0 commit comments