SeededRandomService class

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.

Not a GetxService/singleton — a caller (e.g. one game session) owns its own instance, seeded explicitly with the seed that session's replay capsule needs to reproduce (same "caller supplies and owns state, this class only computes" convention as VersionedJsonStore).

Constructors

SeededRandomService(int rootSeed)

Properties

hashCode → int
The hash code for this object.
no setterinherited
rootSeed → int
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
restoreSnapshots(Map<String, RandomSnapshot> snapshots) → void
Restores every namespace in snapshots to its saved state — overwriting that namespace's current stream (or creating it fresh at that state, if it was never touched on this instance).
snapshotAll() → Map<String, RandomSnapshot>
Snapshots every namespace stream created so far (via stream), keyed by namespace. Pass to restoreSnapshots to resume every one of them at its exact point.
stream(String namespace) → SeededRandom
Gets (creating on first call) the deterministic stream for namespace. The same namespace on the same rootSeed always starts from the same derived seed, and repeated calls for the same namespace return the SAME instance (its sequence keeps advancing across calls, it isn't reset).
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited