12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152moduletypeRANDOM=sig(** Generate Random Numbers *)type'at(** Generator, generating random values of type ['a]. *)valconstant:'a->'at(** [constant a] Generate the same value every time. *)val(>>=):'at->('a->'bt)->'bt(** [rand >>= f] Generate the random value [a] using the generator [rand],
and then use [f a] to generate a random value [b].
*)val(let*):'at->('a->'bt)->'bt(** [let* a = rand in f a] is the same as [rand >>= f]. *)valmap:('a->'b)->'at->'bt(** [map f rand] Use [rand] to generate a random value and then map it by
[f]. *)valint:int->intt(** [int bound] A random generator which generates numbers [n] satisfying
[0 <= n < bound].
Precondition: [0 < bound]
*)valfloat:float->floatt(** [float bound] A random generator which generates numbers [n] satisfying
[0.0 <= n <= bound].
Precondition: [0 <= bound]
*)valbool:boolt(** Generate a random boolean value. *)valchoose:'alist->'at(** [uniform lst] Generate a random value of the list [lst].
Precondition: List must not be empty [lst <> []]
*)end