public final class JDKRandomWrapper extends Object implements UniformRandomProvider
Random instance to implement UniformRandomProvider. All methods from
the Random that match those in UniformRandomProvider are used directly.
This class can be used to wrap an instance of
SecureRandom. The SecureRandom class provides
cryptographic random number generation. The features available depend on the Java version
and platform. Consult the Java documentation for more details.
Note: Use of java.util.Random is not recommended for applications.
There are many other pseudo-random number generators that are statistically superior and often
faster (see RandomSource).
SecureRandom,
RandomSource| Constructor and Description |
|---|
JDKRandomWrapper(Random rng)
Create a wrapper around a Random instance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
nextBoolean() |
void |
nextBytes(byte[] bytes) |
void |
nextBytes(byte[] bytes,
int start,
int len) |
double |
nextDouble() |
float |
nextFloat() |
int |
nextInt() |
int |
nextInt(int n) |
long |
nextLong() |
long |
nextLong(long n) |
public JDKRandomWrapper(Random rng)
rng - JDK Random instance to which the random number
generation is delegated.public void nextBytes(byte[] bytes)
nextBytes in interface UniformRandomProviderpublic void nextBytes(byte[] bytes, int start, int len)
nextBytes in interface UniformRandomProviderpublic int nextInt()
nextInt in interface UniformRandomProviderpublic int nextInt(int n)
nextInt in interface UniformRandomProviderpublic long nextLong()
nextLong in interface UniformRandomProviderpublic long nextLong(long n)
nextLong in interface UniformRandomProviderpublic boolean nextBoolean()
nextBoolean in interface UniformRandomProviderpublic float nextFloat()
nextFloat in interface UniformRandomProviderpublic double nextDouble()
nextDouble in interface UniformRandomProviderCopyright © 2016–2022 The Apache Software Foundation. All rights reserved.