Skip to content

$(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.

!command add !dice $(sender) rolls the dice... it's a $(random.1-6)!
Example chat
ViewerName:!dice
partner badgemoderator badgeStreamElements:ViewerName rolls the dice... it's a 4!

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)!

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.

The dice roll is: $(random.1-6)
Your lucky number is: $(random.number 1-100)
  • 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.

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)
Here's a random emote: $(random.emote)
Let's celebrate with $(random.emote)!

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>.

Congratulations, $(random.chatter)! You've been selected!
Our spotlight viewer is: $(random.chatter)

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)
Today's special is: $(random.pick 'pizza' 'pasta' 'salad')
The next game we'll play is: $(random.pick Fortnite,Minecraft,Valorant)
  • A list of items separated by spaces (quote any multi-word items), or a single comma-separated list
  • $(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.