Skip to content

Latest commit

 

History

History
114 lines (69 loc) · 2.9 KB

File-std-random-ml-66683891.md

File metadata and controls

114 lines (69 loc) · 2.9 KB

std/random.ml

Home · Files

Provides deterministic or securely auto-seeded non-cryptographic generators.

Package: std.random

Reachable from entry: no

Imports

Declarations

autoSeeded

function autoSeeded()

Create an independent RNG seeded by the platform's secure random provider. Returns RNG on success; provider errors propagate and can be caught with try. The generated sequence is still non-cryptographic; use std.crypto.secureRandom for secrets. Linux requires OpenSSL 3. Do not share a mutable RNG across threads without synchronization; normally create one instance per thread.

Source: std/random.ml:135

choice

function choice(rng, xs)

Picks a random element from an array.

Parameter Type Default Description
rng dynamic — Value supplied for rng.
xs dynamic — Value supplied for xs.

Source: std/random.ml:161

DEFAULT_SEED

const DEFAULT_SEED = 1831565813

Track the default seed value used by this standard-library module.

Source: std/random.ml:25

seeded

function seeded(seed)

Constructs a seeded RNG.

Parameter Type Default Description
seed dynamic — Value supplied for seed.

Source: std/random.ml:111

shuffleInPlace

function shuffleInPlace(rng, xs)

Shuffles an array in place using Fisher-Yates.

Parameter Type Default Description
rng dynamic — Value supplied for rng.
xs dynamic — Value supplied for xs.

Source: std/random.ml:142

U32_MASK

const U32_MASK = 4294967295

Std.random Simple deterministic PRNG (xorshift32). - Deterministic across runs. - Not cryptographically secure.

Source: std/random.ml:23

U32_RANGE_FLOAT

const U32_RANGE_FLOAT = 4294967296.

Track the u32 range float value used by this standard-library module.

Source: std/random.ml:27