Module java.base

Interface RandomGenerator.SplittableGenerator

All Superinterfaces:
RandomGenerator, RandomGenerator.StreamableGenerator
All Known Implementing Classes:
SplittableRandom
Enclosing interface:
RandomGenerator

public static interface RandomGenerator.SplittableGenerator extends RandomGenerator.StreamableGenerator
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 RandomGenerator.SplittableGenerator objects produced by recursive splitting from a single original RandomGenerator.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 RandomGenerator.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 RandomGenerator.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.