public abstract class Random64 extends Random
Random
objects which natively creates random long values. All other
Random functions are optimized using this long values.
public class MyRandom64 extends Random64 {
@Override
public long nextLong() {
// Only this method must be implemented.
...
}
}| Modifier | Constructor and Description |
|---|---|
protected |
Random64() |
protected |
Random64(long seed) |
| Modifier and Type | Method and Description |
|---|---|
protected int |
next(int bits) |
boolean |
nextBoolean() |
void |
nextBytes(byte[] bytes)
Optimized version of the
Random.nextBytes(byte[]) method for
64-bit random engines. |
double |
nextDouble()
Optimized version of the
Random.nextDouble() method for 64-bit
random engines. |
double |
nextDouble(double min,
double max)
Returns a pseudorandom, uniformly distributed double value between
min (inclusively) and max (exclusively).
|
float |
nextFloat() |
float |
nextFloat(float min,
float max)
Returns a pseudorandom, uniformly distributed double value between
min (inclusively) and max (exclusively).
|
int |
nextInt() |
int |
nextInt(int min,
int max)
Returns a pseudorandom, uniformly distributed int value between min and
max (end points included).
|
abstract long |
nextLong()
Force to explicitly override the Random.nextLong() method.
|
long |
nextLong(long n)
Returns a pseudorandom, uniformly distributed int value between 0
(inclusive) and the specified value (exclusive), drawn from the given
random number generator's sequence.
|
long |
nextLong(long min,
long max)
Returns a pseudorandom, uniformly distributed int value between min
and max (end points included).
|
static Random64 |
of(LongSupplier supplier)
Create a new
Random64 instance, where the random numbers are
generated by the given long supplier. |
public abstract long nextLong()
public boolean nextBoolean()
nextBoolean in class Randompublic void nextBytes(byte[] bytes)
Random.nextBytes(byte[]) method for
64-bit random engines.public double nextDouble()
Random.nextDouble() method for 64-bit
random engines.nextDouble in class Randompublic static Random64 of(LongSupplier supplier)
Random64 instance, where the random numbers are
generated by the given long supplier.supplier - the random number supplierRandom64 instanceNullPointerException - if the given supplier is
null.public int nextInt(int min, int max)
min - lower bound for generated integer (inclusively)max - upper bound for generated integer (inclusively)min and less
than or equal to maxIllegalArgumentException - if min >= maxrandom.nextInt(java.util.Random, int, int)public long nextLong(long min, long max)
min - lower bound for generated long integer (inclusively)max - upper bound for generated long integer (inclusively)min
and less than or equal to maxIllegalArgumentException - if min >= maxrandom.nextLong(java.util.Random, long, long)public long nextLong(long n)
n - the bound on the random number to be returned. Must be
positive.IllegalArgumentException - if n is smaller than 1.random.nextLong(java.util.Random, long)public float nextFloat(float min, float max)
min - lower bound for generated float value (inclusively)max - upper bound for generated float value (exclusively)min and less
than to maxrandom.nextFloat(java.util.Random, float, float)public double nextDouble(double min, double max)
min - lower bound for generated double value (inclusively)max - upper bound for generated double value (exclusively)min and less
than to maxrandom.nextDouble(java.util.Random, double, double)© 2007-2017 Franz Wilhelmstötter (2017-04-28 16:50)