Skip to content

toMathRandom

toMathRandom(source): () => number

Defined in: src/compat.ts:24

A Math.random-compatible function backed by source.

For handing a seeded stream to a library that only takes a Math.random-shaped function.

EngineLike | Random

() => number

const rand = toMathRandom(new Random(42));
rand(); // 0.3964157... reproducible