Reference · Framing, geometry and quiz tools
seededRandomfunction
A stream of numbers in [0, 1) fixed by a seed. The seed is read as an unsigned 32-bit integer.
Import it
import { seededRandom } from "@johnmorrisdotca/chizu";
Definition
function seededRandom(seed: number): Random
Parameters
| Name | Type | Description |
|---|---|---|
seed | number | A reproducible numeric seed, read as an unsigned 32-bit integer. |
Returns
Random
A stream of numbers in [0, 1) fixed by a seed. The seed is read as an unsigned 32-bit integer.
Examples
import { seededRandom } from "@johnmorrisdotca/chizu";
const a = seededRandom(42);
const b = seededRandom(42);
console.log(a() === b(), a() === b());
// true truetrue trueWhat it prints (run when this page was built)