Module Sfmt_216091

module Sfmt_216091: sig .. end

SIMD oriented Fast Mersenne Twister pseudorandom number generator, with the period 2^216091 - 1 in 32 bit units.


Information

val get_id_string : unit -> string

The identification string of this generator. It is the value of SFMT_IDSTR.

val min_int32_array_length : int

The minimum length of array used for Sfmt_216091.fill_int32_bigarray. It is the value of SFMT_N32.

val min_int64_array_length : int

The minimum length of array used for Sfmt_216091.fill_int64_bigarray. It is the value of SFMT_N64.

Generator

type t 

The type of the state.

Initialization

val make_int32 : int32 -> t
val make_int32_array : int32 array -> t
val make : int array -> t
val make_self_init : unit -> t
val copy : t -> t

Bit generation

val bits32 : t -> int32

Draws out 32 bits. It calls sfmt_genrand_uint32.

val bits64 : t -> int64

Draws out 64 bits. It calls sfmt_genrand_uint64.

val float_bits32 : t -> float

Draws out 32 bits as float [0,1). It calls sfmt_genrand_real2.

val float_bits53 : t -> float

Draws out 53 bits of higher part of 64 bits as float [0,1). It calls sfmt_genrand_res53.

val fill_int32_bigarray : t ->
(int32, Stdlib.Bigarray.int32_elt, Stdlib.Bigarray.c_layout)
Stdlib.Bigarray.Array1.t -> int -> int -> unit

Draws out 32 bit values into the specified bigarray by one call. The length of the array must be at least Sfmt_216091.min_int32_array_length and a multiple of four. This can not be used after calling one of the functions drawing out an individual value. It calls sfmt_fill_array32.

val fill_int64_bigarray : t ->
(int64, Stdlib.Bigarray.int64_elt, Stdlib.Bigarray.c_layout)
Stdlib.Bigarray.Array1.t -> int -> int -> unit

Draws out 64 bit values into the specified bigarray by one call. The length of the array must be at least Sfmt_216091.min_int64_array_length and a multiple of two. This can not be used after calling one of the functions drawing out an individual value. It calls sfmt_fill_array64.

Uniform distribution

val int : t -> int -> int

[0,bound). Draws out values repeatedly as needed in 32 bit units if the bound fits into 32 bits otherwise 64 bit units.

val int32 : t -> int32 -> int32
val int64 : t -> int64 -> int64
val nativeint : t -> nativeint -> nativeint
val float : t -> float -> float

[0,bound), unlike Stdlib.Random.float. Draws out 64 bits once.

val bool : t -> bool

false or true. Draws out 32 bits once.

Serialization

val import : int32 array * int -> t
val export : t -> int32 array * int