module BC_Random: sig end
The random number generators use the
MT(Mersenne Twister) algorithm written in C.
See also MT home page
val int : int -> intval float : float -> floatval sgenrandint : int -> unitval genrandint : unit -> intval sgenrand : int -> unitval genrand : unit -> floatval sample_array : int -> 'a array -> 'a arraysample_array k a
randomly selects k elements from array a of n elements (Floyd's Algorithm?).Invalid_argument when k > nval sample_list : int -> 'a list -> 'a listsample_list k l
randomly selects k elements from list l of n elements (Floyd's Algorithm?).Invalid_argument when k > nval cross_sample_list : int -> 'a list -> ('a list * 'a list) listcross_sample_list k l
randomly divides the list l into k lists (s_{0} .. s_{k-1})
of (almost) equal size, and returns the list of pairs: (s_{i}, l - s_{i}) for i = 0 .. k-1.
The number of elements in each of the k sets is:
k_{0} : n/k + (n mod k), and k_1, ..., k_{k-1} : n/k
where n is the length of l.val sample : int -> int -> int listsample k n
randomly selects k integers from the set : {0, 1, ..., n-1}.Invalid_argument when k > nval cross_sample : int -> int -> (int list * int list) listcross_sample k n
randomly divides the set : {0, 1, ..., n-1} into k sets
(s_{0} .. s_{k-1}) of (almost) equal size
and returns list of pairs: (s_{i}, n - s_{i}) for i = 0 .. k-1.
The number of elements in each of the k sets is:
k_{0} : n/k + (n mod k), and k_1, ..., k_{k-1} : n/k