Random
Random module: purely-functional pseudorandom number generation.
Algorithm: xoshiro256 adapted for 63-bit integers (March/OCaml native int). State: 4 × 63-bit integers packed into the Rng record. Seeding: SplitMix-inspired hash expansion from a single integer.
Usage: let rng = Random.seed(42) let (x, rng2) = Random.next_int(rng) let (f, rng3) = Random.next_float(rng2)
All functions are pure: they take an Rng and return (value, new_Rng). No global mutable state.
Types
Functions
Generate the next pseudorandom integer (full 63-bit signed range).
Generate a random integer in [lo, hi] (inclusive).
Generate a random integer in [lo, hi] (inclusive) using the current time as seed.
Shuffle a list using the Fisher-Yates algorithm. Returns (shuffled_list, new_rng). O(n²) on lists. Same seed + same list always produces the same shuffle.