SplittableRandom (Java SE 26 & JDK 26)
- All Implemented Interfaces:
RandomGenerator, RandomGenerator.SplittableGenerator, RandomGenerator.StreamableGenerator
-
Nested Class Summary
Nested classes/interfaces declared in interface RandomGenerator
RandomGenerator.ArbitrarilyJumpableGenerator, RandomGenerator.JumpableGenerator, RandomGenerator.LeapableGenerator, RandomGenerator.SplittableGenerator, RandomGenerator.StreamableGeneratorstatic interfaceThis interface is designed to provide a common protocol for objects that generate sequences of pseudorandom values and can easily jump forward, by an arbitrary amount, to a distant point in the state cycle.
static interfaceThis interface is designed to provide a common protocol for objects that generate pseudorandom values and can easily jump forward, by a moderate amount (ex. 264) to a distant point in the state cycle.
static interfaceThis interface is designed to provide a common protocol for objects that generate sequences of pseudorandom values and can easily not only jump but also leap forward, by a large amount (ex. 2128), to a very distant point in the state cycle.
static interfaceThis interface is designed to provide a common protocol for objects that generate sequences of pseudorandom values and can be split into two objects (the original one and a new one) each of which obey that same protocol (and therefore can be recursively split indefinitely).
static interface -
Constructor Summary
Constructors
Creates a new SplittableRandom instance that is likely to generate sequences of values that are statistically independent of those of any other instances in the current program; and may, and typically does, vary across program invocations.
SplittableRandom(long seed) Creates a new SplittableRandom instance using the specified initial seed.
-
Method Summary
doubles()Returns an effectively unlimited stream of pseudorandom
doublevalues from this generator and/or one split from it; each value is between zero (inclusive) and one (exclusive).doubles(double randomNumberOrigin, double randomNumberBound) Returns an effectively unlimited stream of pseudorandom
doublevalues from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).doubles(long streamSize) Returns a stream producing the given
streamSizenumber of pseudorandomdoublevalues from this generator and/or one split from it; each value is between zero (inclusive) and one (exclusive).doubles(long streamSize, double randomNumberOrigin, double randomNumberBound) Returns a stream producing the given
streamSizenumber of pseudorandomdoublevalues from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).ints()Returns an effectively unlimited stream of pseudorandom
intvalues from this generator and/or one split from it.ints(int randomNumberOrigin, int randomNumberBound) Returns an effectively unlimited stream of pseudorandom
intvalues from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).ints(long streamSize) Returns a stream producing the given
streamSizenumber of pseudorandomintvalues from this generator and/or one split from it.ints(long streamSize, int randomNumberOrigin, int randomNumberBound) Returns a stream producing the given
streamSizenumber of pseudorandomintvalues from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).longs()Returns an effectively unlimited stream of pseudorandom
longvalues from this generator and/or one split from it.longs(long streamSize) Returns a stream producing the given
streamSizenumber of pseudorandomlongvalues from this generator and/or one split from it.longs(long randomNumberOrigin, long randomNumberBound) Returns an effectively unlimited stream of pseudorandom
longvalues from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).longs(long streamSize, long randomNumberOrigin, long randomNumberBound) Returns a stream producing the given
streamSizenumber of pseudorandomlongvalues from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).voidnextBytes(byte[] bytes) Fills a user-supplied byte array with generated byte values pseudorandomly chosen uniformly from the range of values between -128 (inclusive) and 127 (inclusive).
longnextLong()Returns a pseudorandomly chosen
longvalue.split()Constructs and returns a new SplittableRandom instance that shares no mutable state with this instance.
splits()splits(long streamSize) Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitCreates and returns a copy of this object.
booleanIndicates whether some other object is "equal to" this one.
protected voidDeprecated, for removal: This API element is subject to removal in a future version.
Returns the runtime class of this
Object.intReturns a hash code value for this object.
final voidWakes up a single thread that is waiting on this object's monitor.
final voidWakes up all threads that are waiting on this object's monitor.
Returns a string representation of the object.
final voidCauses the current thread to wait until it is awakened, typically by being notified or interrupted.
final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
Methods declared in interface RandomGenerator
equiDoubles, isDeprecated, nextBoolean, nextDouble, nextDouble, nextDouble, nextExponential, nextFloat, nextFloat, nextFloat, nextGaussian, nextGaussian, nextInt, nextInt, nextInt, nextLong, nextLongequiDoubles(double left, double right, boolean isLeftIncluded, boolean isRightIncluded) Returns an effectively unlimited stream of pseudorandomly chosen
doublevalues, where each value is between the specifiedleftboundary and the specifiedrightboundary.default booleanReturn true if the implementation of RandomGenerator (algorithm) has been marked for deprecation.
default booleanReturns a pseudorandomly chosen
booleanvalue.default doubleReturns a pseudorandom
doublevalue between zero (inclusive) and one (exclusive).default doubleReturns a pseudorandomly chosen
doublevalue between zero (inclusive) and the specified bound (exclusive).default doubleReturns a pseudorandomly chosen
doublevalue between the specified origin (inclusive) and the specified bound (exclusive).default doubleReturns a nonnegative
doublevalue pseudorandomly chosen from an exponential distribution whose mean is 1.default floatReturns a pseudorandom
floatvalue between zero (inclusive) and one (exclusive).default floatReturns a pseudorandomly chosen
floatvalue between zero (inclusive) and the specified bound (exclusive).default floatReturns a pseudorandomly chosen
floatvalue between the specified origin (inclusive) and the specified bound (exclusive).default doubleReturns a
doublevalue pseudorandomly chosen from a Gaussian (normal) distribution whose mean is 0 and whose standard deviation is 1.default doubleReturns a
doublevalue pseudorandomly chosen from a Gaussian (normal) distribution with a mean and standard deviation specified by the arguments.default intReturns a pseudorandomly chosen
intvalue.default intReturns a pseudorandomly chosen
intvalue between zero (inclusive) and the specified bound (exclusive).default intnextInt(int origin, int bound) Returns a pseudorandomly chosen
intvalue between the specified origin (inclusive) and the specified bound (exclusive).default longReturns a pseudorandomly chosen
longvalue between zero (inclusive) and the specified bound (exclusive).default longnextLong(long origin, long bound) Returns a pseudorandomly chosen
longvalue between the specified origin (inclusive) and the specified bound (exclusive).
-
Constructor Details
-
SplittableRandom
-
SplittableRandom
-
-
Method Details
-
split
-
split
-
nextLong
-
nextBytes
-
splits
-
splits
-
splits
-
splits
-
ints
-
ints
-
ints
-
ints
-
longs
-
longs
-
longs
-
longs
-
doubles
-
doubles
-
doubles
-
doubles
-