/random Command in Minecraft Java Edition

Roll Numbers and Manage Random Sequences

Java EditionLogic & ScoreboardAdded in 1.20.2

The /random command lets you generate random numbers within a chosen range and control the random number sequences in your world. You can use it to roll a value or reset sequences back to a starting state.

Players and map makers use this command when building mini-games, rolling dice, or testing features that need predictable outcomes by setting a specific seed.

Syntax (Java 26.3, 8 forms)

  1. /random reset *
  2. /random reset * <seed>
  3. /random reset * <seed> <includeWorldSeed> [<includeSequenceId>]
  4. /random reset <sequence>
  5. /random reset <sequence> <seed>
  6. /random reset <sequence> <seed> <includeWorldSeed> [<includeSequenceId>]
  7. /random roll <range> [<sequence>]
  8. /random value <range> [<sequence>]

The forms you will use most

/random roll <range> [<sequence>]
Rolls a random number within the given range, optionally using a specific sequence ID.
/random value <range> [<sequence>]
Generates a random value from the specified number range, with an optional sequence ID.
/random reset *
Resets all random sequences in the world at once.
/random reset * <seed>
Resets every random sequence using a specific whole number as the seed.
/random reset * <seed> <includeWorldSeed> [<includeSequenceId>]
Resets all sequences with a custom seed and lets you choose whether to include the world seed and sequence ID.
/random reset <sequence>
Resets one specific random sequence identified by its resource ID.
/random reset <sequence> <seed>
Resets a single chosen sequence using a specific whole number seed.
/random reset <sequence> <seed> <includeWorldSeed> [<includeSequenceId>]
Resets a specific sequence with a seed while controlling the world seed and sequence ID options.

Arguments

ArgumentTypeWhat it means
<seed>whole numberA positive or negative whole number, such as 5 or -3, used to reset a sequence.
<includeWorldSeed>true / falseA true or false value that decides whether the world seed is included when resetting.
<includeSequenceId>true / falseA true or false value that decides whether the sequence ID is included during a reset.
<sequence>resource IDA namespaced resource ID that identifies a specific random sequence.
<range>number rangeA number or number range to pick from, such as 5, 1..10, ..3, or 4...

Examples

Version history

Measured from the game files of every Java release from 1.13 to 26.3.

  1. 1.20.2 Command added.

Tips

Common mistakes

Java vs Bedrock

The /random command is only available in Minecraft Java Edition. Bedrock Edition does not have a command with this name.

FAQ

When was the /random command added to Minecraft?

The /random command was added to Minecraft Java Edition in version 1.20.2.

Can I use the /random command in Minecraft Bedrock Edition?

No, Bedrock Edition does not have a command named /random.

How do I reset all random sequences at once?

You can reset every sequence at the same time by running /random reset *, with the option to add a seed and true or false settings after the asterisk.

Related commands

/bossbar/data/execute/function/return/schedule/scoreboard/tag/team/trigger