EigenRng class final

The engine's deterministic random stream, ported bit for bit from the kernel's deriveRng in server/packages/kernel/src/rng.ts.

The server derives a transition's stream as rand-seed 3.0.0's default generator (sfc32) keyed by "<seed>:<version>", and a bot's as "<seed>:bot<seat>:<version>". A local game is replayed by the authoritative TypeScript rules when it is imported, so a draw that differs by one bit produces a different game on the server than the one the player watched: this port is required to be exact, not close, and test/local/rng_test.dart pins it against vectors taken from the installed npm package on both the VM and a browser.

Implemented types

Constructors

EigenRng.forBot(String seed, int seat, int version)
The stream one bot brain draws from at seat when acting on the state at version: the twin of the Durable Object's deriveRng("${seed}:bot${seat}", version), which is drawn from the version the bot's move is committed against, not the one it produces.
factory
EigenRng.forSeed(String seed)
The stream keyed by seed exactly as given: the twin of rand-seed's own new Rand(seed).
factory
EigenRng.forTransition(String seed, int version)
The stream for the transition committing as version in the game whose base seed is seed: the twin of deriveRng(seed, version).
factory

Properties

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

Methods

next() → double
The next draw in [0, 1). Stateful within one transition.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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