Class StatefulRandom
java.lang.Object
com.knezevic.edaf.v3.core.rng.StatefulRandom
- All Implemented Interfaces:
Serializable
Lightweight deterministic RNG with explicit serializable state.
This implementation uses xorshift64* for reproducible stream state persistence.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublebooleandoubleReturns a uniformly distributed double in [0, 1).doubleReturns a normal distributed sample using Box-Muller transform.intnextInt(int bound) Returns a uniformly distributed integer in [0, bound).longnextLong()Returns a uniformly distributed long.voidrestore(long state, boolean hasGaussian, double gaussian) longstate()
-
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.
-