public class SplitMix64RandomGenerator extends AbstractRandomGenerator
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,
RandomGenerator,
SplitMix64Random| Constructor and Description |
|---|
SplitMix64RandomGenerator()
Creates a new generator seeded using
Util.randomSeed(). |
SplitMix64RandomGenerator(long seed)
Creates a new generator using a given seed.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
main(String[] arg) |
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.
|
clear, nextGaussian, setSeed, setSeedpublic SplitMix64RandomGenerator()
Util.randomSeed().public SplitMix64RandomGenerator(long seed)
seed - a nonzero seed for the generator (if zero, the generator will be seeded with -1).public long nextLong()
nextLong in interface RandomGeneratornextLong in class AbstractRandomGeneratorpublic int nextInt()
nextInt in interface RandomGeneratornextInt in class AbstractRandomGeneratorpublic int nextInt(int n)
nextInt in interface RandomGeneratornextInt in class AbstractRandomGeneratorpublic 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 interface RandomGeneratornextDouble in class AbstractRandomGeneratorpublic float nextFloat()
nextFloat in interface RandomGeneratornextFloat in class AbstractRandomGeneratorpublic boolean nextBoolean()
nextBoolean in interface RandomGeneratornextBoolean in class AbstractRandomGeneratorpublic void nextBytes(byte[] bytes)
nextBytes in interface RandomGeneratornextBytes in class AbstractRandomGeneratorpublic void setSeed(long seed)
The seed will be passed through HashCommon.murmurHash3(long).
setSeed in interface RandomGeneratorsetSeed in class AbstractRandomGeneratorseed - a seed for this generator.public void setState(long state)
state - the new state for this generator (must be nonzero).public static void main(String[] arg)