Added in API level 35

StreamableGenerator

interface StreamableGenerator : 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 java.util.random.RandomGenerator.SplittableGenerator#splits() method to implement the java.util.random.RandomGenerator.StreamableGenerator#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
open static RandomGenerator.StreamableGenerator!
of(name: String!)

Returns an instance of StreamableGenerator that utilizes the name algorithm.

abstract Stream<RandomGenerator!>!

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

open Stream<RandomGenerator!>!
rngs(streamSize: Long)

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

Inherited functions

Public methods

of

Added in API level 35
open static fun of(name: String!): RandomGenerator.StreamableGenerator!

Returns an instance of StreamableGenerator that utilizes the name algorithm.

Parameters
name String!: Name of random number generator algorithm
Return
RandomGenerator.StreamableGenerator! An instance of StreamableGenerator
Exceptions
java.lang.NullPointerException if name is null
java.lang.IllegalArgumentException if the named algorithm is not found

rngs

Added in API level 35
abstract fun rngs(): Stream<RandomGenerator!>!

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.

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

rngs

Added in API level 35
open fun rngs(streamSize: Long): Stream<RandomGenerator!>!

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.

Parameters
streamSize Long: the number of generators to generate
Return
Stream<RandomGenerator!>! a stream of objects that implement the RandomGenerator interface
Exceptions
java.lang.IllegalArgumentException if streamSize is less than zero