Package net.minecraft.util.math.random
Interface Random
- All Known Subinterfaces:
- BaseRandom
- All Known Implementing Classes:
- CheckedRandom,- ChunkRandom,- LocalRandom,- RandomSequencesState.WrappedRandom,- ThreadSafeRandom,- Xoroshiro128PlusPlusRandom
public interface Random
A reimplementation of 
Random.
 There are four built-in implementations, three based on the classic Java algorithm and one using Xoroshiro128++ algorithm.
- LocalRandom: Silently breaks when used concurrently. Based on- Random.
- CheckedRandom: Throws when used concurrently. Based on- Random.
- ThreadSafeRandom: Blocks the thread when used concurrently. Based on- Random.
- Xoroshiro128PlusPlusRandom: Silently breaks when used concurrently. Implements the Xoroshiro128++ algorithm.
- See Also:
- Implementation Note:
- Note that due to MC-239059, this is not an exact reimplementation of the Java random number generator algorithm.
- Mappings:
- Namespace - Name - named - net/minecraft/util/math/random/Random- intermediary - net/minecraft/class_5819- official - azh
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescriptionstatic Randomcreate()Returns a random.static Randomcreate(long seed) Returns a random with the givenseed.static RandomReturns a random split from the thread local random.static RandomDeprecated.This one is hard to ensure deterministic behavior compared to the non-thread-safe one.default intnextBetween(int min, int max) default intnextBetweenExclusive(int min, int max) booleandoublefloatdoubleintnextInt()intnextInt(int bound) longnextLong()default doublenextTriangular(double mode, double deviation) Returns a randomdoublebetweenmode - deviationandmode + deviation(both inclusive) with modemode.voidsetSeed(long seed) default voidskip(int count) split()
- 
Field Details- 
field_38930Deprecated.- See Also:
- Mappings:
- Namespace - Name - Mixin selector - named - field_38930- Lnet/minecraft/util/math/random/Random;field_38930:D- intermediary - field_38930- Lnet/minecraft/class_5819;field_38930:D- official - a- Lazh;a:D
 
 
- 
- 
Method Details- 
createReturns a random. The returned random actively detects concurrent usage and fails on detection.- Returns:
- a random
- Mappings:
- Namespace - Name - Mixin selector - named - create- Lnet/minecraft/util/math/random/Random;create()Lnet/minecraft/util/math/random/Random;- intermediary - method_43047- Lnet/minecraft/class_5819;method_43047()Lnet/minecraft/class_5819;- official - a- Lazh;a()Lazh;
 
- 
createThreadSafeDeprecated.This one is hard to ensure deterministic behavior compared to the non-thread-safe one.Returns a random, suitable for multithreaded scenarios.- Returns:
- a random, suitable for multithreaded scenarios
- Mappings:
- Namespace - Name - Mixin selector - named - createThreadSafe- Lnet/minecraft/util/math/random/Random;createThreadSafe()Lnet/minecraft/util/math/random/Random;- intermediary - method_43050- Lnet/minecraft/class_5819;method_43050()Lnet/minecraft/class_5819;- official - b- Lazh;b()Lazh;
 
- 
createReturns a random with the givenseed. The returned random actively detects concurrent usage and fails on detection.- Returns:
- a random with the given seed
- Mappings:
- Namespace - Name - Mixin selector - named - create- Lnet/minecraft/util/math/random/Random;create(J)Lnet/minecraft/util/math/random/Random;- intermediary - method_43049- Lnet/minecraft/class_5819;method_43049(J)Lnet/minecraft/class_5819;- official - a- Lazh;a(J)Lazh;
 
- 
createLocalReturns a random split from the thread local random. Users must ensure this random is not used concurrently.- Returns:
- a random split from the thread local random
- Mappings:
- Namespace - Name - Mixin selector - named - createLocal- Lnet/minecraft/util/math/random/Random;createLocal()Lnet/minecraft/util/math/random/Random;- intermediary - method_43053- Lnet/minecraft/class_5819;method_43053()Lnet/minecraft/class_5819;- official - c- Lazh;c()Lazh;
 
- 
splitRandom split()- Mappings:
- Namespace - Name - Mixin selector - named - split- Lnet/minecraft/util/math/random/Random;split()Lnet/minecraft/util/math/random/Random;- intermediary - method_38420- Lnet/minecraft/class_5819;method_38420()Lnet/minecraft/class_5819;- official - d- Lazh;d()Lazh;
 
- 
nextSplitterRandomSplitter nextSplitter()- Mappings:
- Namespace - Name - Mixin selector - named - nextSplitter- Lnet/minecraft/util/math/random/Random;nextSplitter()Lnet/minecraft/util/math/random/RandomSplitter;- intermediary - method_38421- Lnet/minecraft/class_5819;method_38421()Lnet/minecraft/class_6574;- official - e- Lazh;e()Ldyj;
 
- 
setSeedvoid setSeed(long seed) - Mappings:
- Namespace - Name - Mixin selector - named - setSeed- Lnet/minecraft/util/math/random/Random;setSeed(J)V- intermediary - method_43052- Lnet/minecraft/class_5819;method_43052(J)V- official - b- Lazh;b(J)V
 
- 
nextIntint nextInt()- Mappings:
- Namespace - Name - Mixin selector - named - nextInt- Lnet/minecraft/util/math/random/Random;nextInt()I- intermediary - method_43054- Lnet/minecraft/class_5819;method_43054()I- official - f- Lazh;f()I
 
- 
nextIntint nextInt(int bound) - Mappings:
- Namespace - Name - Mixin selector - named - nextInt- Lnet/minecraft/util/math/random/Random;nextInt(I)I- intermediary - method_43048- Lnet/minecraft/class_5819;method_43048(I)I- official - a- Lazh;a(I)I
 
- 
nextBetweendefault int nextBetween(int min, int max) - Mappings:
- Namespace - Name - Mixin selector - named - nextBetween- Lnet/minecraft/util/math/random/Random;nextBetween(II)I- intermediary - method_39332- Lnet/minecraft/class_5819;method_39332(II)I- official - a- Lazh;a(II)I
 
- 
nextLonglong nextLong()- Mappings:
- Namespace - Name - Mixin selector - named - nextLong- Lnet/minecraft/util/math/random/Random;nextLong()J- intermediary - method_43055- Lnet/minecraft/class_5819;method_43055()J- official - g- Lazh;g()J
 
- 
nextBooleanboolean nextBoolean()- Mappings:
- Namespace - Name - Mixin selector - named - nextBoolean- Lnet/minecraft/util/math/random/Random;nextBoolean()Z- intermediary - method_43056- Lnet/minecraft/class_5819;method_43056()Z- official - h- Lazh;h()Z
 
- 
nextFloatfloat nextFloat()- Mappings:
- Namespace - Name - Mixin selector - named - nextFloat- Lnet/minecraft/util/math/random/Random;nextFloat()F- intermediary - method_43057- Lnet/minecraft/class_5819;method_43057()F- official - i- Lazh;i()F
 
- 
nextDoubledouble nextDouble()- Mappings:
- Namespace - Name - Mixin selector - named - nextDouble- Lnet/minecraft/util/math/random/Random;nextDouble()D- intermediary - method_43058- Lnet/minecraft/class_5819;method_43058()D- official - j- Lazh;j()D
 
- 
nextGaussiandouble nextGaussian()- Mappings:
- Namespace - Name - Mixin selector - named - nextGaussian- Lnet/minecraft/util/math/random/Random;nextGaussian()D- intermediary - method_43059- Lnet/minecraft/class_5819;method_43059()D- official - k- Lazh;k()D
 
- 
nextTriangulardefault double nextTriangular(double mode, double deviation) Returns a randomdoublebetweenmode - deviationandmode + deviation(both inclusive) with modemode.Because the return value follows a symmetric triangular distribution, the distribution's mean and median are equal to mode.- Returns:
- a random doublebetweenmode - deviationandmode + deviation(both inclusive) with modemode
- Mappings:
- Namespace - Name - Mixin selector - named - nextTriangular- Lnet/minecraft/util/math/random/Random;nextTriangular(DD)D- intermediary - method_43385- Lnet/minecraft/class_5819;method_43385(DD)D- official - a- Lazh;a(DD)D
 
- 
skipdefault void skip(int count) - Mappings:
- Namespace - Name - Mixin selector - named - skip- Lnet/minecraft/util/math/random/Random;skip(I)V- intermediary - method_33650- Lnet/minecraft/class_5819;method_33650(I)V- official - b- Lazh;b(I)V
 
- 
nextBetweenExclusivedefault int nextBetweenExclusive(int min, int max) - Mappings:
- Namespace - Name - Mixin selector - named - nextBetweenExclusive- Lnet/minecraft/util/math/random/Random;nextBetweenExclusive(II)I- intermediary - method_43051- Lnet/minecraft/class_5819;method_43051(II)I- official - b- Lazh;b(II)I
 
 
-