/** * rng.ts – shared, optionally-seeded random source for weight initialisation. * * Weight init across the model and every block used to duplicate the same * `Math.random()` Box–Muller draw. That made cold-start weights * non-reproducible across machines. This module centralises the draw and lets * the model install a deterministic seed for the duration of construction, so * the same `seed` yields byte-identical initial weights everywhere. * * The default (unseeded) source delegates to `Math.random`, preserving the * original behaviour for callers that don't request a seed. * * The seeded generator uses the same LCG constants as tools/generate-bin.js so * tooling and runtime agree on what a "seed N" model looks like. */ /** Deterministic linear-congruential generator (Numerical Recipes constants). */ export declare class SeededRng { private _s; constructor(seed: number); /** Next float in [0, 1). */ next(): number; } /** * Installs (or clears) the deterministic init seed. * Pass a number to make subsequent `randn`/`gaussianArray` draws reproducible; * pass `undefined` to restore the default `Math.random` source. * * Construction is synchronous, so a process-wide source is safe: seed before * building a model and clear afterwards. */ export declare function setInitSeed(seed: number | undefined): void; /** Box–Muller Gaussian sample from the active source. */ export declare function randn(std?: number): number; /** Returns a Float32Array of `n` Gaussian samples with the given standard deviation. */ export declare function gaussianArray(n: number, std: number): Float32Array; //# sourceMappingURL=rng.d.ts.map