Package net.minecraft.util
Interface RandomSource
- All Known Subinterfaces:
BitRandomSource
- All Known Implementing Classes:
LegacyRandomSource
,RandomSequences.DirtyMarkingRandomSource
,SingleThreadedRandomSource
,ThreadSafeLegacyRandomSource
,WorldgenRandom
,XoroshiroRandomSource
public interface RandomSource
A basic interface for random number generation. This mirrors the same methods in
Random
, however it does not make any guarantee that these are thread-safe, unlike Random
.
The notable difference is that setSeed(long)
is not synchronized
and should not be accessed from multiple threads.
The documentation for each individual method can be assumed to be otherwise the same as the identically named method in Random
.- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault void
consumeCount
(int pCount) static RandomSource
create()
static RandomSource
create
(long pSeed) static RandomSource
static RandomSource
Deprecated.fork()
boolean
double
float
double
int
nextInt()
int
nextInt
(int pBound) default int
nextInt
(int pOrigin, int pBound) default int
nextIntBetweenInclusive
(int pMin, int pMax) long
nextLong()
void
setSeed
(long pSeed) default double
triangle
(double pCenter, double pMaxDeviation)
-
Field Details
-
GAUSSIAN_SPREAD_FACTOR
Deprecated.- See Also:
-
-
Method Details
-
create
-
createThreadSafe
Deprecated. -
create
-
createNewThreadLocalInstance
-
fork
RandomSource fork() -
forkPositional
PositionalRandomFactory forkPositional() -
setSeed
void setSeed(long pSeed) -
nextInt
int nextInt() -
nextInt
int nextInt(int pBound) -
nextIntBetweenInclusive
default int nextIntBetweenInclusive(int pMin, int pMax) -
nextLong
long nextLong() -
nextBoolean
boolean nextBoolean() -
nextFloat
float nextFloat() -
nextDouble
double nextDouble() -
nextGaussian
double nextGaussian() -
triangle
default double triangle(double pCenter, double pMaxDeviation) -
consumeCount
default void consumeCount(int pCount) -
nextInt
default int nextInt(int pOrigin, int pBound)
-