Wiki 9Minecraft Wiki 9Minecraft
Minecraft Legends › BSharpReferenceSheet › Random Number Generation

Random Number Generation

Minecraft Legends

BSharpReferenceSheet
Official docs

Avoid the standard library's Math.random() as it is not deterministic between instances of the game. Stick to QUERY_RandomNumber and QUERY_RandomNumberGroup.

The Number returned by QUERY_RandomNumber and QUERY_RandomNumberGroup is an integer and can immediately be used as an array index.

Consider using QUERY_RandomNumberGroup for consistent randomness that you do not want to be affected by other areas of the game (eg: the player affecting the state of the game world).