Syntax
crypt.random(length: integer): stringArguments
| Name | Type | Description |
|---|---|---|
length | integer | Number of bytes to generate. |
Returns
| Name | Type | Description |
|---|---|---|
bytes | string | Random byte string with the requested length. |
Description
Generates random bytes for nonces, salts, or temporary tokens.
Call it with 1 parameter(s): length. The argument table explains which values are required and which ones only refine the behavior.
It returns bytes (string). Use the returns table to separate successful values from nil results and recoverable errors.
Example
Example call with placeholder values.
local result = crypt.random(1)
print(result)