Math & Text
random
$random[]
Generates a random integer between min and max (inclusive). The value is evaluated at compile-time only.
Syntax
$random[min;max]
$random[]
The $random[] function generates a random integer between min and max, with both values being inclusive.
Important: This function is evaluated at compile-time, meaning the value is determined once when the code is compiled. It will not change if the code is executed multiple times without recompilation.
Syntax
$random[min;max]
Parameters
| Parameter | Description |
|---|---|
min |
The lower bound of the random range (inclusive). |
max |
The upper bound of the random range (inclusive). |
Return Value
A random integer as a string, between min and max (inclusive bounds).
Behavior
- Values are evaluated only once at the time of command compilation.
- Both
minandmaxbounds are inclusive in the possible range. - If
maxis less thanmin, the behavior may be unpredictable.
Examples
Random number between 1 and 100
$random[1;100]
Dice roll
🎲 You rolled a **$random[1;6]**!
Random selection in an embed
$title[Prize draw]
$description[The winning number is: **$random[1000;9999]**]
$footer[🎉 Congratulations to the winner!]
Notes
- Use
$randomString[]to generate random alphanumeric strings. - Use
$randomText[]to randomly choose from a list of text options.