Class StatefulRandom

java.lang.Object
com.knezevic.edaf.v3.core.rng.StatefulRandom
All Implemented Interfaces:
Serializable

public final class StatefulRandom extends Object implements Serializable
Lightweight deterministic RNG with explicit serializable state. This implementation uses xorshift64* for reproducible stream state persistence.
See Also:
  • Constructor Details

    • StatefulRandom

      public StatefulRandom(long seed)
  • Method Details

    • state

      public long state()
    • restore

      public void restore(long state, boolean hasGaussian, double gaussian)
    • hasGaussian

      public boolean hasGaussian()
    • gaussianCache

      public double gaussianCache()
    • nextLong

      public long nextLong()
      Returns a uniformly distributed long.
    • nextDouble

      public double nextDouble()
      Returns a uniformly distributed double in [0, 1).
    • nextInt

      public int nextInt(int bound)
      Returns a uniformly distributed integer in [0, bound).
    • nextGaussian

      public double nextGaussian()
      Returns a normal distributed sample using Box-Muller transform.