public final class RandomCompat
extends java.lang.Object
Random class.| Constructor and Description |
|---|
RandomCompat()
Constructs object, inner
random created with default constructor. |
RandomCompat(long seed)
Constructs object, inner
random created with seed passed as param. |
RandomCompat(java.util.Random random)
Constructs object with the given
Random instance. |
| Modifier and Type | Method and Description |
|---|---|
DoubleStream |
doubles()
Returns an effectively unlimited stream of pseudorandom
double values,
each between zero (inclusive) and one (exclusive). |
DoubleStream |
doubles(double randomNumberOrigin,
double randomNumberBound)
Returns an effectively unlimited stream of pseudorandom
double
values, each conforming to the given origin (inclusive) and bound (exclusive) |
DoubleStream |
doubles(long streamSize)
Returns a stream producing the given
streamSize number of
pseudorandom double values, each between zero (inclusive)
and one (exclusive). |
DoubleStream |
doubles(long streamSize,
double randomNumberOrigin,
double randomNumberBound)
Returns a stream producing the given
streamSize number
of pseudorandom double values, each conforming
to the given origin (inclusive) and bound (exclusive). |
java.util.Random |
getRandom()
Returns underlying
Random instance. |
IntStream |
ints()
Returns an effectively unlimited stream of pseudorandom
int
values. |
IntStream |
ints(int randomNumberOrigin,
int randomNumberBound)
Returns an effectively unlimited stream of pseudorandom
int
values, each conforming to the given origin (inclusive) and bound (exclusive) |
IntStream |
ints(long streamSize)
Returns a stream producing the given
streamSize number of
pseudorandom int values. |
IntStream |
ints(long streamSize,
int randomNumberOrigin,
int randomNumberBound)
Returns a stream producing the given
streamSize number
of pseudorandom int values, each conforming to the given
origin (inclusive) and bound (exclusive). |
LongStream |
longs()
Returns an effectively unlimited stream of pseudorandom
long values,
each between zero (inclusive) and one (exclusive). |
LongStream |
longs(long streamSize)
Returns a stream producing the given
streamSize number of
pseudorandom long values, each between zero (inclusive)
and one (exclusive). |
LongStream |
longs(long randomNumberOrigin,
long randomNumberBound)
Returns an effectively unlimited stream of pseudorandom
long
values, each conforming to the given origin (inclusive) and bound (exclusive) |
LongStream |
longs(long streamSize,
long randomNumberOrigin,
long randomNumberBound)
Returns a stream producing the given
streamSize number
of pseudorandom long values, each conforming
to the given origin (inclusive) and bound (exclusive). |
public RandomCompat()
random created with default constructor.public RandomCompat(long seed)
random created with seed passed as param.seed - seed to initialize random objectpublic RandomCompat(@NotNull
java.util.Random random)
Random instance.random - Random instance@NotNull public java.util.Random getRandom()
Random instance.Random object instance@NotNull public IntStream ints(long streamSize)
streamSize number of
pseudorandom int values.
A pseudorandom int value is generated as if it's the result of
calling the method Random.nextInt()
streamSize - the number of values to generateint valuesjava.lang.IllegalArgumentException - if streamSize is
less than zero@NotNull public LongStream longs(long streamSize)
streamSize number of
pseudorandom long values, each between zero (inclusive)
and one (exclusive).
A pseudorandom long value is generated as if it's the result of
calling the method Random.nextLong()
streamSize - the number of values to generatelong valuesjava.lang.IllegalArgumentException - if streamSize is
less than zero@NotNull public DoubleStream doubles(long streamSize)
streamSize number of
pseudorandom double values, each between zero (inclusive)
and one (exclusive).
A pseudorandom double value is generated as if it's the result of
calling the method Random.nextDouble()
streamSize - the number of values to generatedouble valuesjava.lang.IllegalArgumentException - if streamSize is
less than zero@NotNull public IntStream ints()
int
values.
A pseudorandom int value is generated as if it's the result of
calling the method Random.nextInt().
int values@NotNull public LongStream longs()
long values,
each between zero (inclusive) and one (exclusive).
A pseudorandom long value is generated as if it's the result of
calling the method Random.nextLong().
long values@NotNull public DoubleStream doubles()
double values,
each between zero (inclusive) and one (exclusive).
A pseudorandom double value is generated as if it's the result of
calling the method Random.nextDouble().
double values@NotNull public IntStream ints(long streamSize, int randomNumberOrigin, int randomNumberBound)
streamSize number
of pseudorandom int values, each conforming to the given
origin (inclusive) and bound (exclusive).streamSize - the number of values to generaterandomNumberOrigin - the origin (inclusive) of each random valuerandomNumberBound - the bound (exclusive) if each random valueint values,
each with the given origin (inclusive) and bound (exclusive)java.lang.IllegalArgumentException - if streamSize is
less than zero, or randomNumberOrigin is
greater than or equal to randomNumberBound@NotNull public LongStream longs(long streamSize, long randomNumberOrigin, long randomNumberBound)
streamSize number
of pseudorandom long values, each conforming
to the given origin (inclusive) and bound (exclusive).streamSize - the number of values to generaterandomNumberOrigin - the origin (inclusive) of each random valuerandomNumberBound - the bound (exclusive) if each random valuelong values,
each with the given origin (inclusive) and bound (exclusive)java.lang.IllegalArgumentException - if streamSize is
less than zero, or randomNumberOrigin is
greater than or equal to randomNumberBound@NotNull public DoubleStream doubles(long streamSize, double randomNumberOrigin, double randomNumberBound)
streamSize number
of pseudorandom double values, each conforming
to the given origin (inclusive) and bound (exclusive).streamSize - the number of values to generaterandomNumberOrigin - the origin (inclusive) of each random valuerandomNumberBound - the bound (exclusive) if each random valuedouble values,
each with the given origin (inclusive) and bound (exclusive)java.lang.IllegalArgumentException - if streamSize is
less than zero, or randomNumberOrigin is
greater than or equal to randomNumberBound@NotNull public IntStream ints(int randomNumberOrigin, int randomNumberBound)
int
values, each conforming to the given origin (inclusive) and bound (exclusive)randomNumberOrigin - the origin (inclusive) of each random valuerandomNumberBound - the bound (exclusive) of each random valueint values,
each with the given origin (inclusive) and bound (exclusive)java.lang.IllegalArgumentException - if randomNumberOrigin
is greater than or equal to randomNumberBound@NotNull public LongStream longs(long randomNumberOrigin, long randomNumberBound)
long
values, each conforming to the given origin (inclusive) and bound (exclusive)randomNumberOrigin - the origin (inclusive) of each random valuerandomNumberBound - the bound (exclusive) of each random valuelong values,
each with the given origin (inclusive) and bound (exclusive)java.lang.IllegalArgumentException - if randomNumberOrigin
is greater than or equal to randomNumberBound@NotNull public DoubleStream doubles(double randomNumberOrigin, double randomNumberBound)
double
values, each conforming to the given origin (inclusive) and bound (exclusive)randomNumberOrigin - the origin (inclusive) of each random valuerandomNumberBound - the bound (exclusive) of each random valuedouble values,
each with the given origin (inclusive) and bound (exclusive)java.lang.IllegalArgumentException - if randomNumberOrigin
is greater than or equal to randomNumberBound