Random Number Generation
Reproducible, independently-seeded RNG streams (see the Backend Interface Contract's RNG expectations for the full stream table).
QuantumCircuitsMPS.RNGRegistry — Type
RNGRegistry(; gates_spacetime, gates_realization, born_measurement, state_init=0)Create RNG registry with seeds for each stream. First 3 arguments (gatesspacetime, gatesrealization, born_measurement) are REQUIRED.
RNGRegistry(::Val{:ct_compat}; circuit, measurement)Create CT.jl-compatible RNG registry where :gatesspacetime, :gatesrealization share the SAME RNG. This matches CT.jl's interleaved consumption pattern for verification.
Used ONLY for Task 8 CT.jl verification with p_proj=0.
QuantumCircuitsMPS.get_rng — Function
get_rng(registry::RNGRegistry, stream::Symbol) -> AbstractRNGGet the raw RNG object for a stream. Low-level API.
QuantumCircuitsMPS.expected_draws — Function
expected_draws(circuit::Circuit, n_steps::Int) -> IntFixed :gates_spacetime coin consumption of circuit over n_steps steps under the v0.1 unified stochastic rule: each stochastic operation consumes exactly ONE scalar coin per element per step (K coins, where K is the common element count of its outcomes' geometries), independent of which outcomes are selected. Deterministic operations consume none.
Set geometries (SingleSite, AdjacentPair, Sites, staircases, Pointer) always count K = 1; broadcast geometries count element_count(geo, L, bc). Outcomes with unequal K violate the unified equal-K rule and make the coin budget ill-defined — this throws an ArgumentError listing each outcome's K.
Since the v0.1 unified engine (Task 9), this count is EXACT for every operation: simulate! draws exactly one :gates_spacetime coin per element slot of every stochastic op, regardless of which outcomes are selected.
Under RNGRegistry(Val(:ct_compat); ...) the :gates_spacetime and :gates_realization streams are the SAME RNG object (CT.jl parity), so Haar draws interleave with coins and the fixed-draw invariant CANNOT hold. Detect such registries with QuantumCircuitsMPS.is_aliased and skip draw-count checks for them.