Skip to main content
Version: v0.0.4

Function: splitmix32()

splitmix32(seed): () => number

A stateful splitmix32 step function. Each call advances the internal 32-bit state and returns the next unsigned 32-bit integer. Deterministic for a given seed.

Parameters

seed

number

The 32-bit seed. Coerced to a 32-bit integer via | 0.

Returns

A nullary function returning the next uint32 in the stream.

() => number

Example

import { splitmix32 } from "@cosyte/synth";
const next = splitmix32(12345);
const a = next(); // deterministic uint32