RandomGenerator.SplittableGenerator | API reference | Android Developers
Summary: Methods | Inherited Methods
public
static
interface
RandomGenerator.SplittableGenerator
implements
RandomGenerator.StreamableGenerator
java.util.random.RandomGenerator.SplittableGenerator
Known indirect subclasses
| SplittableRandom | A generator of uniform pseudorandom values (with period 264) applicable for use in (among other contexts) isolated parallel computations that may generate subtasks. |
This 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).
Ideally, all SplittableGenerator objects produced by
recursive splitting from a single original SplittableGenerator
object are statistically independent of one another and individually
uniform. Therefore we would expect the set of values collectively
generated by a set of such objects to have the same statistical
properties as if the same quantity of values were generated by a single
thread using a single SplittableGenerator object. In practice,
one must settle for some approximation to independence and uniformity.
Methods are provided to perform a single splitting operation and also to produce a stream of generators split off from the original (by either iterative or recursive splitting, or a combination).
Objects that implement SplittableGenerator 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.SplittableGenerator
|
of(String name)
Returns an instance of |
default
Stream<RandomGenerator>
|
rngs(long streamSize)
Returns a stream producing the given |
default
Stream<RandomGenerator>
|
rngs()
Returns an effectively unlimited stream of new pseudorandom number
generators, each of which implements the |
abstract
RandomGenerator.SplittableGenerator
|
split(RandomGenerator.SplittableGenerator source)
Returns a new pseudorandom number generator, split off from this one,
that implements the |
abstract
RandomGenerator.SplittableGenerator
|
split()
Returns a new pseudorandom number generator, split off from this one,
that implements the |
default
Stream<RandomGenerator.SplittableGenerator>
|
splits()
Returns an effectively unlimited stream of new pseudorandom number
generators, each of which implements the |
abstract
Stream<RandomGenerator.SplittableGenerator>
|
splits(long streamSize, RandomGenerator.SplittableGenerator source)
Returns a stream producing the given |
abstract
Stream<RandomGenerator.SplittableGenerator>
|
splits(long streamSize)
Returns a stream producing the given |
abstract
Stream<RandomGenerator.SplittableGenerator>
|
splits(RandomGenerator.SplittableGenerator source)
Returns an effectively unlimited stream of new pseudorandom number
generators, each of which implements the |
Inherited methods | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
From interface
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
From interface
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Public methods
rngs
public Stream<RandomGenerator> rngs (long streamSize)
Returns a stream producing the given streamSize number of new
pseudorandom number generators, each of which implements the
RandomGenerator interface. Ideally the generators in the
stream will appear to be statistically independent.
Implementation Requirements:
- The default implementation calls
splits(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
public Stream<RandomGenerator> rngs ()
Returns an effectively unlimited stream of new pseudorandom number
generators, each of which implements the RandomGenerator
interface. Ideally the generators in the stream will appear to be
statistically independent.
Implementation Requirements:
- The default implementation calls
splits().
| Returns | |
|---|---|
Stream<RandomGenerator> |
a stream of objects that implement the RandomGenerator interface |