Module Base__Random.State
The functions from module State manipulate the current state of the random generator explicitly. This allows using one or several deterministic PRNGs, even in a multi-threaded program, without interference from other parts of the program.
Note that Random.get_state from the standard library is not exposed, because it misleadingly makes a copy of random state, which is not typically the desired outcome for accessing the shared state.
Obtaining multiple generators with good independence properties is nontrivial; see the Splittable_random library for that.
val default : tThis gives access to the default random state, allowing user code to share (and thereby mutate) the random state used by the main functions in
Random.
val make : int array -> tCreates a new state and initializes it with the given seed.
val make_self_init : ?allow_in_tests:bool -> unit -> tCreates a new state and initializes it with a system-dependent low-entropy seed.
val bits : t -> intval int : t -> int -> intval int32 : t -> int32 -> int32val nativeint : t -> nativeint -> nativeintval int64 : t -> int64 -> int64val float : t -> float -> floatval int_incl : t -> int -> int -> intval int32_incl : t -> int32 -> int32 -> int32val nativeint_incl : t -> nativeint -> nativeint -> nativeintval int64_incl : t -> int64 -> int64 -> int64val float_range : t -> float -> float -> floatval bool : t -> boolval char : t -> charval ascii : t -> char