Skip to content
WikilyWIKILY
All games23 Wikis · pick your game
Commands and cheatsAll commands

Switch game

23 Wikis · pick your game
/random

Command

/random

Draws a random whole number from a range, privately or announced to everyone, and resets the random sequences used by the world.

Syntax

/random reset * [<seed> [<includeWorldSeed> [<includeSequenceId>]]]
/random reset <sequence> [<seed> [<includeWorldSeed> [<includeSequenceId>]]]
/random (roll <range>|value <range>) [<sequence>]

Arguments

ArgumentKind of valueWhat to type
<seed>Whole numberFor reset: a whole number that is mixed into the starting point of the sequence.
<includeWorldSeed>True or falseFor reset: true to mix in the world seed so that different worlds give different numbers, false to give the same numbers in every world. Default true.
<includeSequenceId>True or falseFor reset: true to mix in the sequence's id so that different sequences give different numbers, false to make sequences with the same seed identical. Default true.
<sequence>IdFor value and roll: the id of a random sequence to draw from (optional, needs permission level 2). For reset: the sequence to restart, or * for all sequences.
<range>Whole number rangeFor value and roll: the lowest and highest possible number, written as min..max, for example 1..6.

Details

Permission level0: every player
Works in/random value and /random roll with only a range can be used by everyone, without operator status or cheats, in singleplayer, on multiplayer servers, in command blocks and in functions. Naming a sequence and /random reset need permission level 2 (gamemasters): singleplayer with cheats enabled, operators on multiplayer servers, command blocks and functions.
Resultvalue reports "Randomized value: <number>" to the sender only; roll announces "<name> rolled <number> (from <min> to <max>)" to all players. For both, the number /execute store saves is the number drawn. reset reports "Reset random sequence <id>" with result 1, or "Reset <number> random sequence(s)" with the number of sequences as the result.
value and rollBoth draw a number between the two ends of the range, ends included. value shows the number only to whoever ran the command; roll tells every player.
Range limitsThe range must have two different ends, such as 1..6. A single number fails with "The range of the random value must be at least 1". The difference between the ends must be below 2147483647, so a range with an open end such as 1.. is usually too large.
SequencesWithout a sequence the number comes from the world's general randomness. With a sequence id it comes from that named sequence, which gives the same numbers in the same order every time it is reset to the same seed. A sequence is created the first time it is used.
reset <sequence>Restarts one sequence. Without a seed it uses the world's current default settings; with a seed it uses that seed.
reset *Removes all sequences so that each starts again when it is next used. With a seed, the seed and the two true/false settings also become the new defaults for every sequence in the world.
Seed settingsincludeWorldSeed and includeSequenceId are both true when left out.

Examples

/random value 1..6

Draws a number from 1 to 6 and shows it only to you.

/random roll 1..20

Draws a number from 1 to 20 and announces it to all players.

/random value 1..100 minecraft:my_dice

Draws a number from 1 to 100 from the sequence minecraft:my_dice.

/random reset minecraft:my_dice 12345

Restarts the sequence minecraft:my_dice with the seed 12345.

/random reset *

Resets every random sequence in the world.

/random reset * 42 false true

Resets all sequences and makes seed 42 without the world seed the new default.

Join the creator communityThe people who build the Minecraft Java Edition wiki are on our Discord. Ask questions or suggest pages.Join Discord (opens Discord in a new tab)