Skip to main content

Module rng

Module rng 

Source
Expand description

A seeded PRNG, so that label assignment and session ids are reproducible from a run id.

magi needs exactly two random things — which candidate gets which label, and a UUID for each Claude session — and both must be replayable when a run is resumed. A 20-line SplitMix64 covers that without a dependency whose version could change the shuffle out from under a resumed run.

Structs§

SplitMix64
SplitMix64. Fixed algorithm: the sequence for a given seed is part of magi’s on-disk contract, because a resumed run must recompute the same labels.

Functions§

entropy
Entropy for a fresh run id: wall clock nanoseconds mixed with the pid.
fnv1a
FNV-1a over the bytes of s.