engine/rng library

Seeded, platform-identical pseudo-random numbers for theme generation (research theme-engine.md §9, Recommendation 9).

Every operation is 32-bit and masked, and the only multiplications are ×5, ×9 and the 16-bit-limb mul32, so the VM, AOT, dart2js and dart2wasm produce identical streams. Never use dart:math Random(seed) for anything that feeds a generated theme: its stream may change between SDK releases.

Classes

Rng
xoshiro128** 1.1 (Blackman & Vigna 2018), seeded through SplitMix32.
RngTag
Stream tags (one independent stream per theme aspect, research §9.4).
SplitMix32
SplitMix32 (Weyl sequence + fmix32). Only used to expand a 32-bit seed into xoshiro state.

Functions

fmix32(int value) → int
MurmurHash3 fmix32 finaliser: a bijection on 32-bit values.
fnv1a32(String tag) → int
FNV-1a (32-bit) over the low byte of each code unit of an ASCII tag.
mul32(int a, int b) → int
Low 32 bits of a * b for 0 <= a, b < 2^32. Exact on every backend (all intermediates stay below 2^53).
rotl32(int x, int k) → int
Rotates the 32-bit value x left by k (1 ≤ k ≤ 31).