utils.utils.random_string
Declaration
lua
utils.random_string(length [, charset])
Description
Generate random string from character set.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
length | integer | Required | — | String length |
charset | string | Optional | "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" | Character pool |
Return Values
| Type | Description |
|---|---|
| string | Random string |
Example
lua
local s = utils.random_string(16)
local hex = utils.random_string(8, "0123456789abcdef")