crypt.random
Generates cryptographically random bytes.
Syntax
crypt.random(length: number) -> string
Parameters
| Parameter | Type | Description |
|---|---|---|
length | number | Number of random bytes, from 0 through 512. |
Returns
| Type | Description |
|---|---|
string | Raw random bytes. |
Description
Length counts random bytes before any encoding, not characters in the returned string. It must be an integer from 0 through 512. The returned string can contain zero bytes; Base64-encode it when passing it through a text-only field.
Example
local value = crypt.random(16)
print(#value)
These are Game executor contracts. Check build requirements and session lifetimes before using them.
