OGTOOLS

Minecraft /random command

Gives a random value in the range you set, or resets the sequence seed.

⚙️ Advanced commands Operator (level 2) Needs cheats enabled Java Edition 26.3

Syntax

/random value <range> [<sequence>]
/random roll <range> [<sequence>]
/random reset <sequence>

Parts in square brackets are optional, parts in angle brackets are required. You do not type the brackets: Put your own value in their place.

Arguments

ArgumentWhat it does
<range> Written like 1..6.
value / roll value returns quietly, roll announces the result to everyone.

Examples

/random value 1..6

Rolls a die.

/execute store result score @s dice run random value 1..20

Writes the result to a score.

Good to know

  • Added in 1.20.2; before that, a loot table trick was used for randomness.
  • Without a sequence name, value and roll can be used by anyone; reset and the sequence argument need permission level 2.

How do I run this command?

Press T in game to open chat (or press / directly), type the command and press Enter. While typing, Tab completes the options. This command counts as a cheat: It needs cheats enabled in a singleplayer world, and operator permission on a server (operator (level 2)).

Related commands

⚙️ More Advanced commands

Another tool Minecraft crafting recipes Would rather make the item than give it with a command? See the recipe on the 3x3 grid.

Minecraft is a product of Mojang Studios. This tool is an independent helper made for players and is not affiliated with Mojang or Microsoft.