Logo FS-Skia-UI

Random Module

Types

Type Description

RngState

Opaque pure RNG state (the xorshift64 stream word). Carry it through your `Model`; thread it with `nextRng`/`nextBelow`. The representation is `private` — construct it only via `seedRng`, advance it only via `nextRng`/`nextBelow`.

Functions and values

Function or value Description

nextBelow n state

Full Usage: nextBelow n state

Parameters:
Returns: int * RngState

Uniform-ish value in `[0, n)`; requires `n > 0` (raises otherwise). Threads the state like `nextRng`.

n : int
state : RngState
Returns: int * RngState

nextRng state

Full Usage: nextRng state

Parameters:
Returns: uint64 * RngState

One xorshift64 step: the next 64-bit value and the advanced state.

state : RngState
Returns: uint64 * RngState

seedRng seed

Full Usage: seedRng seed

Parameters:
    seed : uint64

Returns: RngState

Expand a seed into an initial state. splitmix64 avoids the all-zero xorshift64 fixed point, so any `seed` (including `0UL`) yields a usable stream.

seed : uint64
Returns: RngState

Type something to start searching.