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.Serializable
A 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 boolean
nextBoolean()
void
nextBytes(byte[] bytes)
double
nextDouble()
float
nextFloat()
int
nextInt()
int
nextInt(int n)
long
nextLong()
long
nextLong(long n)
void
setSeed(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:
setSeed
in interfaceorg.apache.commons.math3.random.RandomGenerator
- Specified by:
setSeed
in classorg.apache.commons.math3.random.AbstractRandomGenerator
-
nextLong
public long nextLong()
- Specified by:
nextLong
in interfaceorg.apache.commons.math3.random.RandomGenerator
- Overrides:
nextLong
in classorg.apache.commons.math3.random.AbstractRandomGenerator
-
nextInt
public int nextInt()
- Specified by:
nextInt
in interfaceorg.apache.commons.math3.random.RandomGenerator
- Overrides:
nextInt
in classorg.apache.commons.math3.random.AbstractRandomGenerator
-
nextInt
public int nextInt(int n)
- Specified by:
nextInt
in interfaceorg.apache.commons.math3.random.RandomGenerator
- Overrides:
nextInt
in classorg.apache.commons.math3.random.AbstractRandomGenerator
-
nextLong
public long nextLong(long n)
-
nextDouble
public double nextDouble()
- Specified by:
nextDouble
in interfaceorg.apache.commons.math3.random.RandomGenerator
- Specified by:
nextDouble
in classorg.apache.commons.math3.random.AbstractRandomGenerator
-
nextFloat
public float nextFloat()
- Specified by:
nextFloat
in interfaceorg.apache.commons.math3.random.RandomGenerator
- Overrides:
nextFloat
in classorg.apache.commons.math3.random.AbstractRandomGenerator
-
nextBoolean
public boolean nextBoolean()
- Specified by:
nextBoolean
in interfaceorg.apache.commons.math3.random.RandomGenerator
- Overrides:
nextBoolean
in classorg.apache.commons.math3.random.AbstractRandomGenerator
-
nextBytes
public void nextBytes(byte[] bytes)
- Specified by:
nextBytes
in interfaceorg.apache.commons.math3.random.RandomGenerator
- Overrides:
nextBytes
in classorg.apache.commons.math3.random.AbstractRandomGenerator
-
-