From c3f65a4029f0bd1530ee57c453fc5f871beb1082 Mon Sep 17 00:00:00 2001 From: Justin Visser Date: Wed, 10 Jun 2026 13:01:39 +0200 Subject: [PATCH] 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). --- internal/engine/rng.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/engine/rng.go b/internal/engine/rng.go index 009148c..a5670e9 100644 --- a/internal/engine/rng.go +++ b/internal/engine/rng.go @@ -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)) }