Module java.base
Package java.util.random

Interface RandomGenerator.SplittableGenerator

All Superinterfaces:
RandomGenerator, RandomGenerator.StreamableGenerator
All Known Implementing Classes:
RandomSupport.AbstractSplittableGenerator, RandomSupport.AbstractSplittableWithBrineGenerator, 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 numbers (or Boolean values) and furthermore 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).

An implementation of the RandomGenerator.SplittableGenerator interface must provide concrete definitions for the methods nextLong(), period(), split(), split(SplittableGenerator), splits(), splits(long), split(SplittableGenerator), and splits(long, SplittableGenerator). Perhaps the most convenient way to implement this interface is to extend the abstract class RandomSupport.AbstractSplittableGenerator.

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.

Since:
16