Minecraft:Commands/random
More actions
Template:Exclusive Template:Infobox command
Generates a random integer, or controls Minecraft:random sequences in the world.
Syntax
random (value|roll) <range>
- Outputs a random integer.
- Range is given by two integers separated by two periods where the first given number must always be smaller than the second given number.
random (value|roll) <range> <sequence>
- Samples a random integer from the specified random sequence. If the sequence does not exist, it is created with the random sequence settings of the world.
random reset *
- Removes all the random sequences in the world. A random sequence is created with the settings of the world when called by a loot table.
random reset * <seed> [<includeWorldSeed>] [<includeSequenceId>]
- Removes all the random sequences in the world, and sets the random sequence settings of the world. The setting of the world is
0,true,true, if having not executed/random reset * ...command in the world.
random reset <sequence>
- Removes and re-creates a random sequence with the settings of the world. If the sequence does not exist, it is just created.
random reset <sequence> [<seed>] [<includeWorldSeed>] [<includeSequenceId>]
- Removes and re-creates a random sequence with the specified settings instead of the settings of the world. If the sequence does not exist, it is just created.
Arguments
- Whether or not to notify other players of the results when extracting random numbers.
- If it is
value, the result is displayed in chat only to the player executing the command. Ifroll, the result is broadcasted to all players.
- Specifies the range to pick the random number from. The size of the range (calculated by
max - min + 1) should be between 2 and 2147483646. - Template:Arg desc
- Specifies the Minecraft:resource location of a Minecraft:random sequence to sample or reset.
- If there's no sequence with the specified Minecraft:resource location, it is created.
- Template:Arg desc
- The salt value.
- Template:Arg desc
- Whether to incorporate the world seed value with the specified
<seed>when seeding a random sequence. If not specified, defaults totrue. - Template:Arg desc
- Whether to incorporate the hash of the ID with the specified
<seed>when seeding a random sequence. If not specified, defaults totrue. - Template:Arg desc
Examples
Rolls a random number between 1 and 5 and writes it in chat
Generates a random number between 1 and 10 and stores it in a scoreboard called Template:Code for the nearest player
Generates a number between 1 and 3 and displays it with message "Rolled number <rolled number>"
Result
Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table
Output
Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table
History
Minecraft:de:Befehl/random Minecraft:ja:コマンド/random Minecraft:pt:Comandos/random Minecraft:ru:Команды консоли/random Minecraft:zh:命令/random