1(* Random -- random number generator *) 2signature Random = 3sig 4 5type generator 6 7val newgenseed : real -> generator 8val newgen : unit -> generator 9val random : generator -> real 10val randomlist : int * generator -> real list 11val range : int * int -> generator -> int 12val rangelist : int * int -> int * generator -> int list 13 14end 15 16(* 17 [generator] is the type of random number generators, here the 18 linear congruential generators from Paulson 1991, 1996. 19 20 [newgenseed seed] returns a random number generator with the given seed. 21 22 [newgen ()] returns a random number generator, taking the seed from 23 the system clock. 24 25 [random gen] returns a random number in the interval [0..1). 26 27 [randomlist (n, gen)] returns a list of n random numbers in the 28 interval [0,1). 29 30 [range (min, max) gen] returns an integral random number in the 31 range [min, max). Raises Fail if min > max. 32 33 [rangelist (min, max) (n, gen)] returns a list of n integral random 34 numbers in the range [min, max). Raises Fail if min > max. 35*) 36