Provides deterministic or securely auto-seeded non-cryptographic generators.
Package: std.random
Reachable from entry: no
std/crypto.mlascrypto→ std/crypto.ml
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
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
const DEFAULT_SEED = 1831565813Track the default seed value used by this standard-library module.
Source: std/random.ml:25
- std.random.RNG — struct
function seeded(seed)Constructs a seeded RNG.
| Parameter | Type | Default | Description |
|---|---|---|---|
seed |
dynamic |
— | Value supplied for seed. |
Source: std/random.ml:111
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
const U32_MASK = 4294967295Std.random Simple deterministic PRNG (xorshift32). - Deterministic across runs. - Not cryptographically secure.
Source: std/random.ml:23
const U32_RANGE_FLOAT = 4294967296.Track the u32 range float value used by this standard-library module.
Source: std/random.ml:27