Skip to main content

Module rng

Module rng 

Source
Expand description

Deterministic seed derivation for strategies.

Callers derive sub-seeds by mixing a base, a generation index, and a SeedPurpose so parallel streams (selection, mutation, crossover) do not alias. The mixer is rlevo_core::util::seed::splitmix64, the single frozen mixer shared with SeedStream’s trial-level seed fan-out (ADR 0033). The two seed-derivation schemes remain independent: they share the mixer, not a derivation contract.

§Host-RNG convention

All randomness in rlevo-evolution must go through seed_stream. Do not use B::seed(…) + Tensor::random(…) for stochastic EA operators. Burn’s backend-level RNG is a process-wide mutex; seeding it from inside an operator races with parallel test threads and with other concurrent strategy calls, making results non-reproducible and causing intermittent test failures. seed_stream returns a fully-isolated rand::rngs::StdRng whose state is private to the call site.

Enums§

SeedPurpose
Tag identifying which evolutionary operation a sub-stream is for.

Functions§

seed_stream
Derives a seeded PRNG from a base seed, generation counter, and purpose.