Package it.unimi.dsi.util
Class XorGensRandomGenerator
- java.lang.Object
-
- org.apache.commons.math3.random.AbstractRandomGenerator
-
- it.unimi.dsi.util.XorGensRandomGenerator
-
- All Implemented Interfaces:
java.io.Serializable,org.apache.commons.math3.random.RandomGenerator
public class XorGensRandomGenerator extends org.apache.commons.math3.random.AbstractRandomGenerator implements java.io.SerializableA fast, high-quality 64-bit pseudorandom number generator described in “Some long-period random number generators using shift and xors”, ANZIAM Journal 48, C188−C202, 2007.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description XorGensRandomGenerator()Creates a new generator, initializing its seed withUtil.randomSeed().XorGensRandomGenerator(long seed)Creates a new generator using a given seed.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleannextBoolean()voidnextBytes(byte[] bytes)doublenextDouble()floatnextFloat()intnextInt()intnextInt(int n)longnextLong()longnextLong(long n)voidsetSeed(long seed)
-
-
-
Constructor Detail
-
XorGensRandomGenerator
public XorGensRandomGenerator()
Creates a new generator, initializing its seed withUtil.randomSeed().
-
XorGensRandomGenerator
public XorGensRandomGenerator(long seed)
Creates a new generator using a given seed.- Parameters:
seed- a nonzero seed for the generator (if zero, the generator will be seeded with -1).
-
-
Method Detail
-
setSeed
public void setSeed(long seed)
- Specified by:
setSeedin interfaceorg.apache.commons.math3.random.RandomGenerator- Specified by:
setSeedin classorg.apache.commons.math3.random.AbstractRandomGenerator
-
nextLong
public long nextLong()
- Specified by:
nextLongin interfaceorg.apache.commons.math3.random.RandomGenerator- Overrides:
nextLongin classorg.apache.commons.math3.random.AbstractRandomGenerator
-
nextInt
public int nextInt()
- Specified by:
nextIntin interfaceorg.apache.commons.math3.random.RandomGenerator- Overrides:
nextIntin classorg.apache.commons.math3.random.AbstractRandomGenerator
-
nextInt
public int nextInt(int n)
- Specified by:
nextIntin interfaceorg.apache.commons.math3.random.RandomGenerator- Overrides:
nextIntin classorg.apache.commons.math3.random.AbstractRandomGenerator
-
nextLong
public long nextLong(long n)
-
nextDouble
public double nextDouble()
- Specified by:
nextDoublein interfaceorg.apache.commons.math3.random.RandomGenerator- Specified by:
nextDoublein classorg.apache.commons.math3.random.AbstractRandomGenerator
-
nextFloat
public float nextFloat()
- Specified by:
nextFloatin interfaceorg.apache.commons.math3.random.RandomGenerator- Overrides:
nextFloatin classorg.apache.commons.math3.random.AbstractRandomGenerator
-
nextBoolean
public boolean nextBoolean()
- Specified by:
nextBooleanin interfaceorg.apache.commons.math3.random.RandomGenerator- Overrides:
nextBooleanin classorg.apache.commons.math3.random.AbstractRandomGenerator
-
nextBytes
public void nextBytes(byte[] bytes)
- Specified by:
nextBytesin interfaceorg.apache.commons.math3.random.RandomGenerator- Overrides:
nextBytesin classorg.apache.commons.math3.random.AbstractRandomGenerator
-
-