package batteries
Install
Dune Dependency
Authors
Maintainers
Sources
md5=1bcb27dfbd130eb057561196ef851649
sha512=2a56611b09a5f1cba6457539f8b6bc87a5f2a5454b36cdb39f6e0d6a5dac6db179aab1ba87c74dd49cc41df31a9a96feb349028ea41df7371ecb47f4d9dfafc4
doc/batteries.unthreaded/BatRandom/State/index.html
Module BatRandom.State
Manipulate the current state of the random generator.
This allows using one or several deterministic PRNGs, even in a multi-threaded program, without interference from other parts of the program.
type t = Random.State.t
The type of PRNG states.
val make : int array -> t
Create a new state and initialize it with the given seed.
val make_self_init : unit -> t
Create a new state and initialize it with a system-dependent low-entropy seed.
val bits : t -> int
val int : t -> int -> int
val full_int : t -> int -> int
val nativeint : t -> Nativeint.t -> Nativeint.t
val float : t -> float -> float
val bool : t -> bool
val char : t -> char
val enum_nativeint : t -> Nativeint.t -> Nativeint.t BatEnum.t
These functions are the same as the basic functions, except that they use (and update) the given PRNG state instead of the default one.
These functions are the same as the basic functions, except that they use (and update) the given PRNG state instead of the default one.
val nativebits : t -> Nativeint.t
Draw a fresh PRNG state from the given PRNG state. (The given PRNG state is modified.) The new PRNG is statistically independent from the given PRNG. Data can be drawn from both PRNGs, in any order, without risk of correlation. Both PRNGs can be split later, arbitrarily many times.