random(
args: {lix:Pick<Lix,"call">; }):Promise<number>
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().
lix_id unless lix_deterministic_rng_seed is set.lix_deterministic_rng_state.const lix = await openLix();
const r1 = await random({ lix }) // 0.823...
const r2 = await random({ lix }) // 0.156...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...| Parameter | Type |
|---|---|
args | { lix: Pick<Lix, "call">; } |
args.lix | Pick<Lix, "call"> |
Promise<number>