public final class RandomCompat extends Object
| 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(Random random)
Constructs object with the given
Random instance. |
| Modifier and Type | Method and Description |
|---|---|
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). |
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(Random random)
Random instance.random - Random instancepublic Random getRandom()
Random instance.Random object instancepublic 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 valuesIllegalArgumentException - if streamSize is
less than zeropublic IntStream ints()
int
values.
A pseudorandom int value is generated as if it's the result of
calling the method Random.nextInt().
int valuespublic 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)IllegalArgumentException - if streamSize is
less than zero, or randomNumberOrigin is
greater than or equal to randomNumberBoundpublic 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)IllegalArgumentException - if randomNumberOrigin
is greater than or equal to randomNumberBoundCopyright © 2016. All rights reserved.