import type { Algorithm, Layered, NumberGenerator, Options, RandomSource, Salt, Stream, Trace } from "./Types"; /** * Build the library's built-in PRNG from a seed — the genuine article, not a * caller-supplied {@link Salt}: by the time anything reaches here the salt is * one slot of an `encode`d {@link Trace}, and this string is that whole * encoding. The same seed always yields the same stream, and `cyrb128` hashes * it to fully seed sfc32's 128 bits of state. */ export declare function defaultAlgorithm(seed: string): NumberGenerator; /** * Mint a fresh salt value — a uint32 label. Not used as `initialize()`'s * default (an omitted salt is empty; wall-clock `clock` is the default * entropy); kept for callers that want a generated mixer, and for tests that * need one. */ export declare function randomSalt(): string; /** * Derive the explicit `"derived"` clock — an epoch-millisecond instant, drawn * across the full representable `Date` span — from an instance's own * `algorithm`/`salt`. The unconfigured default is wall-clock time * (`Instance/Core.ts`'s `overlay`); this is the opt-in that makes `salt` alone * the reproducibility unit, at the cost of an implausible "now". A throwaway * two-element encoding (`JSON.stringify([salt, "clock"])`), _not_ routed * through `RandomSource`/`Trace`: after the clock is folded into stream * derivation, a forked source's own stream derivation requires a clock, so * deriving the clock from a fork would be circular. Kept below that layer, * which also keeps this collision-free with every leaf's `encode(trace)` — that * encoding is always five elements, this is always two, and the two can never * produce the same JSON array. `Math.trunc`ed because a `Date`'s precision is * whole milliseconds. */ export declare function deriveClock(algorithm: Algorithm, salt: ReadonlyArray): number; /** * Collapse a {@link Trace} into one string to hash — and, since * `toStreamFromTrace` hashes exactly this output, the _definition_ of that * leaf's stream seed. Concatenating fields with a delimiter would collide when * a path/kind/salt part contains that delimiter — silently: two leaves that * should draw independently would share one stream. `JSON.stringify` as an * array makes every field's and slot's boundaries unambiguous regardless of * content or nesting depth. */ export declare function encode(trace: Trace): string; /** * Normalize a caller-supplied {@link Salt} to its parts: a single string becomes * a one-element array, an array passes through unchanged, and a missing salt is * empty — unless {@link envSalt} supplies one. No generated fallback: an omitted * salt is not a second source of entropy beside the instance clock. */ export declare function normalizeSalt(salt: Salt | undefined): ReadonlyArray; /** * Tag a salt as composing onto whatever base is in effect, rather than * replacing it — the reading a bare `salt` has everywhere else in this library. * Mirrors `replace()`'s `[Replace]` tagging: the `[Layer]` directive is read * (and, at every level that accepts one, consumed) by whoever resolves the salt * against its base, so a caller never names the symbol. */ export declare function layer(salt: Salt): Layered; export declare function isLayered(value: unknown): value is Layered; export declare function toStream(algorithm: Algorithm, seed: string): Stream; /** * A leaf's stream: `toStream(algorithm, encode(trace))`. This is the * composition that _defines_ a leaf's stream seed — the invariant * `toStream(algorithm, encode(trace)).seed === stream.seed`. Not a * {@link RandomSource} member: derivation depends on no per-source state (a * fork shares only the algorithm), so it is a free function of `(algorithm, * trace)`. `toConstructionTrace` is the only stateful member. * * {@link deriveClock} cannot route through this: a {@link Trace} carries * `clock`, and `deriveClock` is what produces it. That circularity is why * `deriveClock` stays below the `RandomSource`/`Trace` layer, with a * two-element encoding that can never collide with `encode`'s five. */ export declare function toStreamFromTrace(algorithm: Algorithm, trace: Trace): Stream; /** * Create a fresh, self-contained {@link RandomSource} — the randomness state a * single `initialize()` instance owns for its lifetime. `options.clock` is * baked in here, once, as a plain number — the `"derived"` policy is already * resolved by the caller (`Instance/Core.ts`'s `resolveClock`) before a source * is ever built, so every construction trace this source resolves carries the * identical instant, and `fork` threads it forward unchanged. */ export declare function toRandomSource(options: Options): RandomSource;