Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Commands/random

From SAS Gaming Wiki
Revision as of 15:44, 9 April 2026 by SyncBot (talk | contribs) (Remove broken links to missing pages)

Template:Exclusive Template:Infobox command

Generates a random integer, or controls 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.

Template:See also

Arguments

Template:Code

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. If roll, the result is broadcasted to all players.

Template:Argument

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

Template:Argument

Specifies the resource location of a random sequence to sample or reset.
If there's no sequence with the specified resource location, it is created.
Template:Arg desc

Template:Argument

The salt value.
Template:Arg desc

Template:Argument

Whether to incorporate the world seed value with the specified <seed> when seeding a random sequence. If not specified, defaults to true.
Template:Arg desc

Template:Argument

Whether to incorporate the hash of the ID with the specified <seed> when seeding a random sequence. If not specified, defaults to true.
Template:Arg desc

Examples

Template:Code

Rolls a random number between 1 and 5 and writes it in chat

Template:Code

Generates a random number between 1 and 10 and stores it in a scoreboard called Template:Code for the nearest player

Template:Code

Template:Code

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

Template:HistoryTable

Navigation

Template:Navbox commands

de:Befehl/random ja:コマンド/random pt:Comandos/random ru:Команды консоли/random zh:命令/random