import type { Lix } from "../../lix/open-lix.js"; import type { LixEngine } from "../boot.js"; /** * Sync variant of {@link random}. See {@link random} for behavior and examples. * * @remarks * - Accepts `{ engine }` (or `{ lix }`) and runs next to SQLite. * - Intended for engine/router and UDFs; app code should use {@link random}. * * @see random */ export declare function randomSync(args: { engine: Pick; }): number; /** * @internal * Flush the in-memory RNG state to persistent storage. * * Called automatically by Lix after each committing write and during * `lix.toBlob()` / `lix.close()`. **Not part of the public API.** */ export declare function commitDeterministicRngState(args: { engine: Pick; timestamp?: string; }): void; /** * Returns a random float between 0 (inclusive) and 1 (exclusive). * * In deterministic mode, generates reproducible values using xorshift128+ PRNG * (the same algorithm used by V8/Chrome for Math.random()). In normal mode, uses crypto.getRandomValues(). * * - Normal mode: cryptographic quality via crypto.getRandomValues(). * - Deterministic mode: xorshift128+ PRNG (same as V8/Chrome's Math.random()). * - Default seed: `lix_id` unless `lix_deterministic_rng_seed` is set. * - State persisted via `lix_deterministic_rng_state`. * - Returns 53-bit precision floats in both modes. * - For ID generation, consider {@link uuidV7} or {@link nanoId} instead. * * @example Normal mode – cryptographically secure randomness * ```ts * const lix = await openLix(); * const r1 = await random({ lix }) // 0.823... * const r2 = await random({ lix }) // 0.156... * ``` * * @example Deterministic mode – reproducible randomness * ```ts * const lix = await openLix({ keyValues: [{ key: "lix_deterministic_mode", value: { enabled: true } }] }); * await random({ lix }) // 0.318... * await random({ lix }) // 0.937... * await random({ lix }) // 0.543... * ``` */ export declare function random(args: { lix: Pick; }): Promise; //# sourceMappingURL=random.d.ts.map