Added in API level 35

RandomGenerator.StreamableGenerator

public static interface RandomGenerator.StreamableGenerator
implements RandomGenerator

java.util.random.RandomGenerator.StreamableGenerator


The 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 SplittableGenerator may choose to use its splits() method to implement the rngs() method required by this interface.

A generator that implements interface JumpableGenerator may choose to use its jumps() method to implement the rngs() method required by this interface.

A generator that implements interface LeapableGenerator may choose to use its leaps() method to implement the rngs() method required by this interface.

Objects that implement 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.

Summary

Public methods

static RandomGenerator.StreamableGenerator of(String name)

Returns an instance of StreamableGenerator that utilizes the name algorithm.

default Stream<RandomGenerator> rngs(long streamSize)

Returns an effectively unlimited stream of objects, each of which implements the RandomGenerator interface.

abstract Stream<RandomGenerator> rngs()

Returns an effectively unlimited stream of objects, each of which implements the RandomGenerator interface.

Inherited methods

Public methods

of

Added in API level 35
public static RandomGenerator.StreamableGenerator of (String name)

Returns an instance of StreamableGenerator that utilizes the name algorithm.

Parameters
name String: Name of random number generator algorithm

Returns
RandomGenerator.StreamableGenerator An instance of StreamableGenerator

Throws
NullPointerException if name is null
IllegalArgumentException if the named algorithm is not found

rngs

Added in API level 35
public Stream<RandomGenerator> rngs (long streamSize)

Returns an effectively unlimited stream of objects, each of which implements the 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.

Implementation Requirements:
  • The default implementation calls rngs() and then limits its length to streamSize.
Parameters
streamSize long: the number of generators to generate

Returns
Stream<RandomGenerator> a stream of objects that implement the RandomGenerator interface

Throws
IllegalArgumentException if streamSize is less than zero

rngs

Added in API level 35
public abstract Stream<RandomGenerator> rngs ()

Returns an effectively unlimited stream of objects, each of which implements the 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.

Implementation Note:
Returns
Stream<RandomGenerator> a stream of objects that implement the RandomGenerator interface