Class StochasticState
State for stochastic executors — a seeded PRNG. Deterministic given the seed, reproducible across runs. Mutable: the PRNG seed evolves as the executor steps.
public sealed class StochasticState : IExecutionState
- Inheritance
-
StochasticState
- Implements
- Inherited Members
Constructors
StochasticState(int)
Construct a stochastic state from a seed.
public StochasticState(int seed)
Parameters
seedintInitial PRNG seed.
Properties
Seed
Current PRNG seed (mutable). Read/write is atomic, but this alone does not make a read-modify-write sequence spanning multiple calls thread-safe -- use NextRandom() to advance the seed, not manual read-then-write.
public int Seed { get; set; }
Property Value
Methods
NextNormal(double, double)
Generate a normally-distributed value via Box-Muller (approximate).
public double NextNormal(double mean = 0, double stddev = 1)
Parameters
Returns
NextRandom()
Simple linear-congruential PRNG step. Thread-safe: concurrent callers each get a distinct step of the sequence via compare-and-swap retry, rather than corrupting Seed under a torn or lost update.
public int NextRandom()
Returns
NextUnit()
Generate a uniform random number in [0, 1).
public double NextUnit()