docs engine: state the RNG design decision in rng.go

rng.go is a construction point, not an abstraction wall; components
take *rand.Rand directly (idiomatic Go dependency injection) and only
RunScenario creates streams, from config seeds. Decided 2026-06-10
over the alternatives (interface wall, folding newRand into
scenario.go).
This commit is contained in:
Justin Visser 2026-06-10 13:01:39 +02:00
parent 9bae4a9ca0
commit c3f65a4029

View file

@ -11,6 +11,11 @@ import "math/rand/v2"
// engine never touches global random state; every source of randomness
// (graph build, edge thresholds, education sampling) gets its own seeded
// stream so each can be varied independently.
//
// This file is deliberately NOT a wall around math/rand/v2: components
// take *rand.Rand parameters directly, the idiomatic Go shape. What is
// centralised here is construction; RunScenario is the only caller, so
// "all randomness flows from config seeds" is enforced by structure.
func newRand(seed uint64) *rand.Rand {
return rand.New(rand.NewPCG(seed, 0))
}