Skip to main content
Version: v0.0.5

Function: sfc32Next()

sfc32Next(s): number

Advance an Sfc32State in place by one step and return the next unsigned 32-bit integer.

This is the canonical sfc32 step. The state object is mutated (the counter d increments and the mixing words rotate); callers that need reproducible independence hold their own state and never share it - ../rng/rng.Rng creates a fresh state per seed so two runs from the same seed are identical.

Parameters

s

Sfc32State

The state to advance. Mutated in place.

Returns

number

The next uint32 in the stream.

Example

import { sfc32Next, type Sfc32State } from "@cosyte/synth";
const s: Sfc32State = { a: 1, b: 2, c: 3, d: 4 };
const x = sfc32Next(s); // uint32