Interface SplittableUniformRandomProvider
- All Superinterfaces:
UniformRandomProvider
- All Known Implementing Classes:
L128X1024Mix
,L128X128Mix
,L128X256Mix
,L32X64Mix
,L64X1024Mix
,L64X128Mix
,L64X128StarStar
,L64X256Mix
Ideally all generators produced by recursive splitting from the original object are statistically independent and individually uniform. In this case it would be expected that the set of values collectively generated from a group of split generators would have the same statistical properties as the same number of values produced from a single generator object.
- Since:
- 1.5
-
Method Summary
Modifier and TypeMethodDescriptiondefault DoubleStream
doubles()
Returns an effectively unlimited stream ofdouble
values between 0 (inclusive) and 1 (exclusive).default DoubleStream
doubles
(double origin, double bound) Returns an effectively unlimited stream ofdouble
values between the specifiedorigin
(inclusive) and the specifiedbound
(exclusive).default DoubleStream
doubles
(long streamSize) Returns a stream producing the givenstreamSize
number ofdouble
values between 0 (inclusive) and 1 (exclusive).default DoubleStream
doubles
(long streamSize, double origin, double bound) Returns a stream producing the givenstreamSize
number ofdouble
values between the specifiedorigin
(inclusive) and the specifiedbound
(exclusive).default IntStream
ints()
Returns an effectively unlimited stream ofint
values.default IntStream
ints
(int origin, int bound) Returns an effectively unlimited stream ofint
values between the specifiedorigin
(inclusive) and the specifiedbound
(exclusive).default IntStream
ints
(long streamSize) Returns a stream producing the givenstreamSize
number ofint
values.default IntStream
ints
(long streamSize, int origin, int bound) Returns a stream producing the givenstreamSize
number ofint
values between the specifiedorigin
(inclusive) and the specifiedbound
(exclusive).default LongStream
longs()
Returns an effectively unlimited stream oflong
values.default LongStream
longs
(long streamSize) Returns a stream producing the givenstreamSize
number oflong
values.default LongStream
longs
(long origin, long bound) Returns an effectively unlimited stream oflong
values between the specifiedorigin
(inclusive) and the specifiedbound
(exclusive).default LongStream
longs
(long streamSize, long origin, long bound) Returns a stream producing the givenstreamSize
number oflong
values between the specifiedorigin
(inclusive) and the specifiedbound
(exclusive).default SplittableUniformRandomProvider
split()
Creates a new random generator, split off from this one, that implements theSplittableUniformRandomProvider
interface.split
(UniformRandomProvider source) Creates a new random generator, split off from this one, that implements theSplittableUniformRandomProvider
interface.default Stream
<SplittableUniformRandomProvider> splits()
Returns an effectively unlimited stream of new random generators, each of which implements theSplittableUniformRandomProvider
interface.default Stream
<SplittableUniformRandomProvider> splits
(long streamSize) Returns a stream producing the givenstreamSize
number of new random generators, each of which implements theSplittableUniformRandomProvider
interface.default Stream
<SplittableUniformRandomProvider> splits
(long streamSize, SplittableUniformRandomProvider source) Returns a stream producing the givenstreamSize
number of new random generators, each of which implements theSplittableUniformRandomProvider
interface.default Stream
<SplittableUniformRandomProvider> Returns an effectively unlimited stream of new random generators, each of which implements theSplittableUniformRandomProvider
interface.Methods inherited from interface org.apache.commons.rng.UniformRandomProvider
nextBoolean, nextBytes, nextBytes, nextDouble, nextDouble, nextDouble, nextFloat, nextFloat, nextFloat, nextInt, nextInt, nextInt, nextLong, nextLong, nextLong
-
Method Details
-
split
Creates a new random generator, split off from this one, that implements theSplittableUniformRandomProvider
interface.The current generator may be used a source of randomness to initialise the new instance. In this case repeat invocations of this method will return objects with a different initial state that are expected to be statistically independent.
- Returns:
- A new instance.
-
split
Creates a new random generator, split off from this one, that implements theSplittableUniformRandomProvider
interface.- Parameters:
source
- A source of randomness used to initialise the new instance.- Returns:
- A new instance.
- Throws:
NullPointerException
- ifsource
is null
-
splits
Returns an effectively unlimited stream of new random generators, each of which implements theSplittableUniformRandomProvider
interface.The current generator may be used a source of randomness to initialise the new instances.
- Returns:
- a stream of random generators.
-
splits
Returns an effectively unlimited stream of new random generators, each of which implements theSplittableUniformRandomProvider
interface.- Parameters:
source
- A source of randomness used to initialise the new instances; this may be split to provide a source of randomness across a parallel stream.- Returns:
- a stream of random generators.
- Throws:
NullPointerException
- ifsource
is null
-
splits
Returns a stream producing the givenstreamSize
number of new random generators, each of which implements theSplittableUniformRandomProvider
interface.The current generator may be used a source of randomness to initialise the new instances.
- Parameters:
streamSize
- Number of objects to generate.- Returns:
- a stream of random generators; the stream is limited to the given
streamSize
. - Throws:
IllegalArgumentException
- ifstreamSize
is negative.
-
splits
default Stream<SplittableUniformRandomProvider> splits(long streamSize, SplittableUniformRandomProvider source) Returns a stream producing the givenstreamSize
number of new random generators, each of which implements theSplittableUniformRandomProvider
interface.- Parameters:
streamSize
- Number of objects to generate.source
- A source of randomness used to initialise the new instances; this may be split to provide a source of randomness across a parallel stream.- Returns:
- a stream of random generators; the stream is limited to the given
streamSize
. - Throws:
IllegalArgumentException
- ifstreamSize
is negative.NullPointerException
- ifsource
is null
-
ints
Description copied from interface:UniformRandomProvider
Returns an effectively unlimited stream ofint
values.- Specified by:
ints
in interfaceUniformRandomProvider
- Returns:
- a stream of random
int
values.
-
ints
Description copied from interface:UniformRandomProvider
Returns an effectively unlimited stream ofint
values between the specifiedorigin
(inclusive) and the specifiedbound
(exclusive).- Specified by:
ints
in interfaceUniformRandomProvider
- Parameters:
origin
- Lower bound on the random number to be returned.bound
- Upper bound (exclusive) on the random number to be returned.- Returns:
- a stream of random values between the specified
origin
(inclusive) and the specifiedbound
(exclusive).
-
ints
Description copied from interface:UniformRandomProvider
Returns a stream producing the givenstreamSize
number ofint
values.- Specified by:
ints
in interfaceUniformRandomProvider
- Parameters:
streamSize
- Number of values to generate.- Returns:
- a stream of random
int
values; the stream is limited to the givenstreamSize
.
-
ints
Description copied from interface:UniformRandomProvider
Returns a stream producing the givenstreamSize
number ofint
values between the specifiedorigin
(inclusive) and the specifiedbound
(exclusive).- Specified by:
ints
in interfaceUniformRandomProvider
- Parameters:
streamSize
- Number of values to generate.origin
- Lower bound on the random number to be returned.bound
- Upper bound (exclusive) on the random number to be returned.- Returns:
- a stream of random values between the specified
origin
(inclusive) and the specifiedbound
(exclusive); the stream is limited to the givenstreamSize
.
-
longs
Description copied from interface:UniformRandomProvider
Returns an effectively unlimited stream oflong
values.- Specified by:
longs
in interfaceUniformRandomProvider
- Returns:
- a stream of random
long
values.
-
longs
Description copied from interface:UniformRandomProvider
Returns an effectively unlimited stream oflong
values between the specifiedorigin
(inclusive) and the specifiedbound
(exclusive).- Specified by:
longs
in interfaceUniformRandomProvider
- Parameters:
origin
- Lower bound on the random number to be returned.bound
- Upper bound (exclusive) on the random number to be returned.- Returns:
- a stream of random values between the specified
origin
(inclusive) and the specifiedbound
(exclusive).
-
longs
Description copied from interface:UniformRandomProvider
Returns a stream producing the givenstreamSize
number oflong
values.- Specified by:
longs
in interfaceUniformRandomProvider
- Parameters:
streamSize
- Number of values to generate.- Returns:
- a stream of random
long
values; the stream is limited to the givenstreamSize
.
-
longs
Description copied from interface:UniformRandomProvider
Returns a stream producing the givenstreamSize
number oflong
values between the specifiedorigin
(inclusive) and the specifiedbound
(exclusive).- Specified by:
longs
in interfaceUniformRandomProvider
- Parameters:
streamSize
- Number of values to generate.origin
- Lower bound on the random number to be returned.bound
- Upper bound (exclusive) on the random number to be returned.- Returns:
- a stream of random values between the specified
origin
(inclusive) and the specifiedbound
(exclusive); the stream is limited to the givenstreamSize
.
-
doubles
Description copied from interface:UniformRandomProvider
Returns an effectively unlimited stream ofdouble
values between 0 (inclusive) and 1 (exclusive).- Specified by:
doubles
in interfaceUniformRandomProvider
- Returns:
- a stream of random values between 0 (inclusive) and 1 (exclusive).
-
doubles
Description copied from interface:UniformRandomProvider
Returns an effectively unlimited stream ofdouble
values between the specifiedorigin
(inclusive) and the specifiedbound
(exclusive).- Specified by:
doubles
in interfaceUniformRandomProvider
- Parameters:
origin
- Lower bound on the random number to be returned.bound
- Upper bound (exclusive) on the random number to be returned.- Returns:
- a stream of random values between the specified
origin
(inclusive) and the specifiedbound
(exclusive).
-
doubles
Description copied from interface:UniformRandomProvider
Returns a stream producing the givenstreamSize
number ofdouble
values between 0 (inclusive) and 1 (exclusive).- Specified by:
doubles
in interfaceUniformRandomProvider
- Parameters:
streamSize
- Number of values to generate.- Returns:
- a stream of random values between 0 (inclusive) and 1 (exclusive);
the stream is limited to the given
streamSize
.
-
doubles
Description copied from interface:UniformRandomProvider
Returns a stream producing the givenstreamSize
number ofdouble
values between the specifiedorigin
(inclusive) and the specifiedbound
(exclusive).- Specified by:
doubles
in interfaceUniformRandomProvider
- Parameters:
streamSize
- Number of values to generate.origin
- Lower bound on the random number to be returned.bound
- Upper bound (exclusive) on the random number to be returned.- Returns:
- a stream of random values between the specified
origin
(inclusive) and the specifiedbound
(exclusive); the stream is limited to the givenstreamSize
.
-