public class SplitMix64Random extends Random
SplittableRandom. Due to
the fixed increment constant and to different strategies in generating finite ranges, the methods of this generator
are usually faster than those of SplittableRandom.
Note that this generator has a relatively short period (264) so it should not be used to generate very long sequences (the rule of thumb to have a period greater than the square of the length of the sequence you want to generate).
it.unimi.dsi.util,
Random,
SplitMix64RandomGenerator,
Serialized Form| Constructor and Description |
|---|
SplitMix64Random()
Creates a new generator seeded using
Util.randomSeed(). |
SplitMix64Random(long seed)
Creates a new generator using a given seed.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
nextBoolean() |
void |
nextBytes(byte[] bytes) |
double |
nextDouble() |
float |
nextFloat() |
int |
nextInt() |
int |
nextInt(int n) |
long |
nextLong() |
long |
nextLong(long n)
Returns a pseudorandom uniformly distributed
long value
between 0 (inclusive) and the specified value (exclusive), drawn from
this random number generator's sequence. |
void |
setSeed(long seed)
Sets the seed of this generator.
|
void |
setState(long state)
Sets the state of this generator.
|
public SplitMix64Random()
Util.randomSeed().public SplitMix64Random(long seed)
seed - a nonzero seed for the generator (if zero, the generator will be seeded with -1).public long nextLong(long n)
long value
between 0 (inclusive) and the specified value (exclusive), drawn from
this random number generator's sequence. The algorithm used to generate
the value guarantees that the result is uniform, provided that the
sequence of 64-bit values produced by this generator is.n - the positive bound on the random number to be returned.long value between 0 (inclusive) and n (exclusive).public double nextDouble()
nextDouble in class Randompublic boolean nextBoolean()
nextBoolean in class Randompublic void setSeed(long seed)
The seed will be passed through HashCommon.murmurHash3(long).
public void setState(long state)
state - the new state for this generator (must be nonzero).