Package it.unimi.dsi.util
Class XorShift64StarRandomGenerator
- java.lang.Object
-
- org.apache.commons.math3.random.AbstractRandomGenerator
-
- it.unimi.dsi.util.XorShift64StarRandomGenerator
-
- All Implemented Interfaces:
org.apache.commons.math3.random.RandomGenerator
@Deprecated public class XorShift64StarRandomGenerator extends org.apache.commons.math3.random.AbstractRandomGenerator
Deprecated.UseSplitMix64RandomGeneratorinstead.A fast, good-quality pseudorandom number generator that combines George Marsaglia's Xorshift generators (described in “Xorshift RNGs”, Journal of Statistical Software, 8:1−6, 2003) with a multiplication.
-
-
Constructor Summary
Constructors Constructor Description XorShift64StarRandomGenerator()Deprecated.Creates a new generator seeded usingUtil.randomSeed().XorShift64StarRandomGenerator(long seed)Deprecated.Creates a new generator using a given seed.
-
Method Summary
Modifier and Type Method Description booleannextBoolean()Deprecated.voidnextBytes(byte[] bytes)Deprecated.doublenextDouble()Deprecated.floatnextFloat()Deprecated.intnextInt()Deprecated.intnextInt(int n)Deprecated.Returns a pseudorandom, approximately uniformly distributedintvalue between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.longnextLong()Deprecated.longnextLong(long n)Deprecated.Returns a pseudorandom uniformly distributedlongvalue between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.voidsetSeed(long seed)Deprecated.Sets the seed of this generator.voidsetState(long state)Deprecated.Sets the state of this generator.
-
-
-
Constructor Detail
-
XorShift64StarRandomGenerator
public XorShift64StarRandomGenerator()
Deprecated.Creates a new generator seeded usingUtil.randomSeed().
-
XorShift64StarRandomGenerator
public XorShift64StarRandomGenerator(long seed)
Deprecated.Creates a new generator using a given seed.- Parameters:
seed- a nonzero seed for the generator (if zero, the generator will be seeded withLong.MIN_VALUE).
-
-
Method Detail
-
nextLong
public long nextLong()
Deprecated.- Specified by:
nextLongin interfaceorg.apache.commons.math3.random.RandomGenerator- Overrides:
nextLongin classorg.apache.commons.math3.random.AbstractRandomGenerator
-
nextInt
public int nextInt()
Deprecated.- Specified by:
nextIntin interfaceorg.apache.commons.math3.random.RandomGenerator- Overrides:
nextIntin classorg.apache.commons.math3.random.AbstractRandomGenerator
-
nextInt
public int nextInt(int n)
Deprecated.Returns a pseudorandom, approximately uniformly distributedintvalue between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.The hedge “approximately” is due to the fact that to be always faster than
ThreadLocalRandomwe return the upper 63 bits ofnextLong()moduloninstead of usingRandom's fancy algorithm (whichnextLong(long)uses though). This choice introduces a bias: the numbers from 0 to 263 modnare slightly more likely than the other ones. In the worst case, “more likely” means 1.00000000023 times more likely, which is in practice undetectable. If for some reason you need truly uniform generation, just usenextLong(long).- Specified by:
nextIntin interfaceorg.apache.commons.math3.random.RandomGenerator- Overrides:
nextIntin classorg.apache.commons.math3.random.AbstractRandomGenerator- Parameters:
n- the positive bound on the random number to be returned.- Returns:
- the next pseudorandom
intvalue between0(inclusive) andn(exclusive).
-
nextLong
public long nextLong(long n)
Deprecated.Returns a pseudorandom uniformly distributedlongvalue 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.- Parameters:
n- the positive bound on the random number to be returned.- Returns:
- the next pseudorandom
longvalue between0(inclusive) andn(exclusive).
-
nextDouble
public double nextDouble()
Deprecated.- Specified by:
nextDoublein interfaceorg.apache.commons.math3.random.RandomGenerator- Specified by:
nextDoublein classorg.apache.commons.math3.random.AbstractRandomGenerator
-
nextFloat
public float nextFloat()
Deprecated.- Specified by:
nextFloatin interfaceorg.apache.commons.math3.random.RandomGenerator- Overrides:
nextFloatin classorg.apache.commons.math3.random.AbstractRandomGenerator
-
nextBoolean
public boolean nextBoolean()
Deprecated.- Specified by:
nextBooleanin interfaceorg.apache.commons.math3.random.RandomGenerator- Overrides:
nextBooleanin classorg.apache.commons.math3.random.AbstractRandomGenerator
-
nextBytes
public void nextBytes(byte[] bytes)
Deprecated.- Specified by:
nextBytesin interfaceorg.apache.commons.math3.random.RandomGenerator- Overrides:
nextBytesin classorg.apache.commons.math3.random.AbstractRandomGenerator
-
setSeed
public void setSeed(long seed)
Deprecated.Sets the seed of this generator.The seed will be passed through
HashCommon.murmurHash3(long). In this way, if the user passes a small value we will avoid the short irregular transient associated with states with a very small number of bits set.- Specified by:
setSeedin interfaceorg.apache.commons.math3.random.RandomGenerator- Specified by:
setSeedin classorg.apache.commons.math3.random.AbstractRandomGenerator- Parameters:
seed- a nonzero seed for this generator (if zero, the generator will be seeded withLong.MIN_VALUE).
-
setState
public void setState(long state)
Deprecated.Sets the state of this generator.- Parameters:
state- the new state for this generator (must be nonzero).
-
-