RandomGenerator
RandomGenerator.ArbitrarilyJumpableGenerator
, RandomGenerator.JumpableGenerator
, RandomGenerator.LeapableGenerator
, RandomGenerator.SplittableGenerator
SplittableRandom
RandomGenerator
public static interface RandomGenerator.StreamableGenerator extends RandomGenerator
RandomGenerator.StreamableGenerator
interface augments the RandomGenerator
interface to provide methods that return streams of RandomGenerator
objects. Ideally, such a stream of objects would have the property that the behavior of each object is statistically independent of all the others. In practice, one may have to settle for some approximation to this property. A generator that implements interface RandomGenerator.SplittableGenerator
may choose to use its splits
() method to implement the rngs
() method required by this interface.
A generator that implements interface RandomGenerator.JumpableGenerator
may choose to use its jumps
() method to implement the rngs
() method required by this interface.
A generator that implements interface RandomGenerator.LeapableGenerator
may choose to use its leaps
() method to implement the rngs
() method required by this interface.
Objects that implement RandomGenerator.StreamableGenerator
are typically not cryptographically secure. Consider instead using SecureRandom
to get a cryptographically secure pseudo-random number generator for use by security-sensitive applications.
RandomGenerator.ArbitrarilyJumpableGenerator, RandomGenerator.JumpableGenerator, RandomGenerator.LeapableGenerator, RandomGenerator.SplittableGenerator, RandomGenerator.StreamableGenerator
Modifier and Type | Method | Description |
---|---|---|
static RandomGenerator.StreamableGenerator |
of |
|
Stream |
rngs() |
Returns an effectively unlimited stream of objects, each of which implements the RandomGenerator interface. |
default Stream |
rngs |
Returns an effectively unlimited stream of objects, each of which implements the RandomGenerator interface. |
doubles, doubles, doubles, doubles, ints, ints, ints, ints, isDeprecated, longs, longs, longs, longs, nextBoolean, nextBytes, nextDouble, nextDouble, nextDouble, nextExponential, nextFloat, nextFloat, nextFloat, nextGaussian, nextGaussian, nextInt, nextInt, nextInt, nextLong, nextLong, nextLong
static RandomGenerator.StreamableGenerator of(String name)
name
- Name of random number generator algorithm
RandomGenerator.StreamableGenerator
NullPointerException
- if name is nullIllegalArgumentException
- if the named algorithm is not foundStream<RandomGenerator> rngs()
RandomGenerator
interface. Ideally the generators in the stream will appear to be statistically independent. The new generators are of the same algorithm as this generator.rngs
(Long.MAX_VALUE
).RandomGenerator
interfacedefault Stream<RandomGenerator> rngs(long streamSize)
RandomGenerator
interface. Ideally the generators in the stream will appear to be statistically independent. The new generators are of the same algorithm as this generator.rngs
() and then limits its length to streamSize
.streamSize
- the number of generators to generateRandomGenerator
interfaceIllegalArgumentException
- if streamSize
is less than zero
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/random/RandomGenerator.StreamableGenerator.html