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 |
default
Stream<RandomGenerator>
|
rngs(long streamSize)
Returns an effectively unlimited stream of objects, each of which
implements the |
abstract
Stream<RandomGenerator>
|
rngs()
Returns an effectively unlimited stream of objects, each of which
implements the |
Inherited methods | |
---|---|
Public methods
of
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
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 tostreamSize
.
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
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:
- It is permitted to implement this method in a manner
equivalent to
rngs
(Long.MAX_VALUE
).
Returns | |
---|---|
Stream<RandomGenerator> |
a stream of objects that implement the RandomGenerator interface |