$(random)
- Syntax
$(random)- Arguments
- Optional
StreamElements provides a set of random variables: random numbers in a range, a random pick from a list, a random emote, and a random active chatter. They’re the building blocks for mini-games and giveaway-style commands.
Use it
Section titled “Use it”!command add !dice $(sender) rolls the dice... it's a $(random.1-6)!Random variables can be used in any chat message or command. To use a random variable, simply include it in your message using the following syntax: $(variable_name) or ${variable_name}.
Congratulations, $(random.chatter)! You've won a prize!The magic number is $(random.1-100)!Available variables
Section titled “Available variables”$(random) and number ranges
Section titled “$(random) and number ranges”Bare $(random) generates a random number between 1 and 100. To pick from a custom range, use $(random.X-Y) or $(random.number X-Y).
$(random)$(random.X-Y)$(random.number X-Y)Where X is the lower bound and Y is the upper bound, both inclusive. $(random X-Y) with a single space-separated range also works the same as the dot form.
Examples
Section titled “Examples”The dice roll is: $(random.1-6)Your lucky number is: $(random.number 1-100)Parameters
Section titled “Parameters”X: Lower bound (inclusive)Y: Upper bound (inclusive)
If a bound can’t be parsed as a number, the range falls back to 1–100.
$(random.emote)
Section titled “$(random.emote)”Displays a random emote from the emotes available in the channel, including the channel’s BTTV, FrankerFaceZ, and 7TV emotes as well as global emotes.
$(random.emote)Examples
Section titled “Examples”Here's a random emote: $(random.emote)Let's celebrate with $(random.emote)!$(random.chatter)
Section titled “$(random.chatter)”Selects a random chatter from the current active chatters in the stream.
$(random.chatter)If the chatter list can’t be fetched or is empty, the output is <no chatters>.
Examples
Section titled “Examples”Congratulations, $(random.chatter)! You've been selected!Our spotlight viewer is: $(random.chatter)$(random.pick)
Section titled “$(random.pick)”Selects a random item from a provided list of options.
$(random.pick item1 item2 item3 ...)Wrap multi-word items in quotes. Alternatively, provide the whole list as one comma-separated token (no spaces), which is split on commas:
$(random.pick item1,item2,item3)Examples
Section titled “Examples”Today's special is: $(random.pick 'pizza' 'pasta' 'salad')The next game we'll play is: $(random.pick Fortnite,Minecraft,Valorant)Parameters
Section titled “Parameters”- A list of items separated by spaces (quote any multi-word items), or a single comma-separated list
Related Variables
Section titled “Related Variables”- $(customapi): Fetch content from a URL, which can be used to create more complex random selections
- $(math): Perform mathematical operations and return the result
Q: Can I use random variables in custom commands?
A: Yes, random variables can be used in any custom command or chat message.
Q: Are the random numbers generated truly random?
A: They are pseudorandom — generated by an algorithm — more than sufficient for chat games.