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:
Serialized Form
  • Constructor Details

    • XorGensRandomGenerator

      public XorGensRandomGenerator()
      Creates a new generator, initializing its seed with Util.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 interface org.apache.commons.math3.random.RandomGenerator
      Specified by:
      setSeed in class org.apache.commons.math3.random.AbstractRandomGenerator
    • nextLong

      public long nextLong()
      Specified by:
      nextLong in interface org.apache.commons.math3.random.RandomGenerator
      Overrides:
      nextLong in class org.apache.commons.math3.random.AbstractRandomGenerator
    • nextInt

      public int nextInt()
      Specified by:
      nextInt in interface org.apache.commons.math3.random.RandomGenerator
      Overrides:
      nextInt in class org.apache.commons.math3.random.AbstractRandomGenerator
    • nextInt

      public int nextInt​(int n)
      Specified by:
      nextInt in interface org.apache.commons.math3.random.RandomGenerator
      Overrides:
      nextInt in class org.apache.commons.math3.random.AbstractRandomGenerator
    • nextLong

      public long nextLong​(long n)
    • nextDouble

      public double nextDouble()
      Specified by:
      nextDouble in interface org.apache.commons.math3.random.RandomGenerator
      Specified by:
      nextDouble in class org.apache.commons.math3.random.AbstractRandomGenerator
    • nextFloat

      public float nextFloat()
      Specified by:
      nextFloat in interface org.apache.commons.math3.random.RandomGenerator
      Overrides:
      nextFloat in class org.apache.commons.math3.random.AbstractRandomGenerator
    • nextBoolean

      public boolean nextBoolean()
      Specified by:
      nextBoolean in interface org.apache.commons.math3.random.RandomGenerator
      Overrides:
      nextBoolean in class org.apache.commons.math3.random.AbstractRandomGenerator
    • nextBytes

      public void nextBytes​(byte[] bytes)
      Specified by:
      nextBytes in interface org.apache.commons.math3.random.RandomGenerator
      Overrides:
      nextBytes in class org.apache.commons.math3.random.AbstractRandomGenerator