core/utils/seeded_random
library
Classes
-
CompiledWeightedTable<T>
-
Pre-validates a weighted loot table ONCE at construction — compiling it
into cumulative weights so repeated pick calls (e.g. every enemy
spawn, every loot roll) don't re-validate and re-sum the whole table
every time the way a bare weightedRandomPick call does.
-
RandomSnapshot
-
Opaque, versioned snapshot of a SeededRandom's internal state —
serializable so a caller (e.g. a save file, or IDEA-42's replay capsule)
can persist an RNG stream and later resume it at the exact point it left
off, via SeededRandom.fromSnapshot.
-
SeededRandom
-
Deterministic, cross-platform-stable pseudo-random generator —
implements Random so it's a drop-in source for weightedRandomPick,
List.shuffle, or anywhere else a dart:math Random is accepted.
-
SeededRandomService
-
Manages independent, deterministically-derived SeededRandom streams
keyed by a caller-chosen namespace (e.g.
"loot", "enemy_spawn") —
so one gameplay system calling its own stream an extra time never
shifts another system's sequence, the classic shared-RNG
replay-determinism trap.