Package it.unimi.dsi.util
Class XorGensRandomGenerator
java.lang.Object
org.apache.commons.math3.random.AbstractRandomGenerator
it.unimi.dsi.util.XorGensRandomGenerator
- All Implemented Interfaces:
Serializable
,org.apache.commons.math3.random.RandomGenerator
public class XorGensRandomGenerator
extends org.apache.commons.math3.random.AbstractRandomGenerator
implements 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:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new generator, initializing its seed withUtil.randomSeed()
.XorGensRandomGenerator
(long seed) Creates a new generator using a given seed. -
Method Summary
Methods inherited from class org.apache.commons.math3.random.AbstractRandomGenerator
clear, nextGaussian, setSeed, setSeed
-
Constructor Details
-
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 Details
-
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
-