package pure-splitmix

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

A purely functional splittable PRNG.

type t

PRNG state, immutable.

Initialization

val of_seed : int64 -> t

Initialize from an integer.

val of_string : string -> t

Initialize by hashing a string.

val auto_seed : unit -> t

Initialize impurely in a system-dependent way.

Generate values

A state should be used only once to ensure the outputs are independent.

val split : t -> t * t

Split the state.

val vary : int -> t -> t

Infinitary split. Index must be >= 0.

val next_int64 : t -> int64 * t

Generate 64 random bits, and return a new state.

val int64 : t -> int64

Generate 64 random bits.

val int_signed : t -> int

Generate an int uniformly in the range [min_int, max_int]

val int_nonneg : t -> int

Generate an int uniformly in the range [0, max_int]

val int : t -> int -> int

Generate an int uniformly in a range [0, bound).

val bool : t -> bool

Generate a bool.

Internal functions

module Internal : sig ... end

Exported for testing.

OCaml

Innovation. Community. Security.