java.lang.Object
java.util.Random
io.jenetics.util.RandomAdapter
- All Implemented Interfaces:
Serializable
,RandomGenerator
Some places in the Java API still require a
Random
object instead of
the new RandomGenerator
. This class can be used by using this adapter
class.
final var random = RandomGenerator.getDefault();
final var bi = new BigInteger(100, RandomAdapter.of(random));
- Since:
- 7.0
- Version:
- 7.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.random.RandomGenerator
RandomGenerator.ArbitrarilyJumpableGenerator, RandomGenerator.JumpableGenerator, RandomGenerator.LeapableGenerator, RandomGenerator.SplittableGenerator, RandomGenerator.StreamableGenerator
-
Method Summary
Modifier and TypeMethodDescriptiondoubles()
doubles
(double randomNumberOrigin, double randomNumberBound) doubles
(long streamSize) doubles
(long streamSize, double randomNumberOrigin, double randomNumberBound) ints()
ints
(int randomNumberOrigin, int randomNumberBound) ints
(long streamSize) ints
(long streamSize, int randomNumberOrigin, int randomNumberBound) boolean
longs()
longs
(long streamSize) longs
(long randomNumberOrigin, long randomNumberBound) longs
(long streamSize, long randomNumberOrigin, long randomNumberBound) boolean
void
nextBytes
(byte[] bytes) double
double
nextDouble
(double bound) double
nextDouble
(double origin, double bound) double
float
float
nextFloat
(float bound) float
nextFloat
(float origin, float bound) double
double
nextGaussian
(double mean, double stddev) int
nextInt()
int
nextInt
(int bound) int
nextInt
(int origin, int bound) long
nextLong()
long
nextLong
(long bound) long
nextLong
(long origin, long bound) static Random
of
(RandomGenerator random) Create a newRandom
object from the givenrandom
generator.
-
Method Details
-
isDeprecated
-
doubles
- Specified by:
doubles
in interfaceRandomGenerator
- Overrides:
doubles
in classRandom
-
doubles
- Specified by:
doubles
in interfaceRandomGenerator
- Overrides:
doubles
in classRandom
-
doubles
- Specified by:
doubles
in interfaceRandomGenerator
- Overrides:
doubles
in classRandom
-
doubles
- Specified by:
doubles
in interfaceRandomGenerator
- Overrides:
doubles
in classRandom
-
ints
- Specified by:
ints
in interfaceRandomGenerator
- Overrides:
ints
in classRandom
-
ints
- Specified by:
ints
in interfaceRandomGenerator
- Overrides:
ints
in classRandom
-
ints
- Specified by:
ints
in interfaceRandomGenerator
- Overrides:
ints
in classRandom
-
ints
- Specified by:
ints
in interfaceRandomGenerator
- Overrides:
ints
in classRandom
-
longs
- Specified by:
longs
in interfaceRandomGenerator
- Overrides:
longs
in classRandom
-
longs
- Specified by:
longs
in interfaceRandomGenerator
- Overrides:
longs
in classRandom
-
longs
- Specified by:
longs
in interfaceRandomGenerator
- Overrides:
longs
in classRandom
-
longs
- Specified by:
longs
in interfaceRandomGenerator
- Overrides:
longs
in classRandom
-
nextBoolean
- Specified by:
nextBoolean
in interfaceRandomGenerator
- Overrides:
nextBoolean
in classRandom
-
nextBytes
- Specified by:
nextBytes
in interfaceRandomGenerator
- Overrides:
nextBytes
in classRandom
-
nextFloat
- Specified by:
nextFloat
in interfaceRandomGenerator
- Overrides:
nextFloat
in classRandom
-
nextFloat
-
nextFloat
-
nextDouble
- Specified by:
nextDouble
in interfaceRandomGenerator
- Overrides:
nextDouble
in classRandom
-
nextDouble
-
nextDouble
-
nextInt
- Specified by:
nextInt
in interfaceRandomGenerator
- Overrides:
nextInt
in classRandom
-
nextInt
- Specified by:
nextInt
in interfaceRandomGenerator
- Overrides:
nextInt
in classRandom
-
nextInt
-
nextLong
- Specified by:
nextLong
in interfaceRandomGenerator
- Overrides:
nextLong
in classRandom
-
nextLong
-
nextLong
-
nextGaussian
- Specified by:
nextGaussian
in interfaceRandomGenerator
- Overrides:
nextGaussian
in classRandom
-
nextGaussian
-
nextExponential
-
of
Create a newRandom
object from the givenrandom
generator.- Parameters:
random
- the random generator to adapt- Returns:
- the adapted random generator
-