alice
library
manual.

Alice Project

The Rand structure


________ Synopsis ____________________________________________________

    signature RAND
    structure Rand : RAND
  

The Rand provides access to the operating system's pseudo-random number generator.


________ Import ______________________________________________________

    import signature RAND from "x-alice:/lib/system/RAND-sig"
    import structure Rand from "x-alice:/lib/system/Rand"

________ Interface ___________________________________________________

    signature RAND =
    sig
	val rand :       unit -> int
	val srand :      int -> unit
	val randLimits : unit -> int * int
    end
  

________ Description _________________________________________________

rand ()

Returns a pseudo-random integer between lo and hi, where (lo,hi) = randLimits().

srand i

Sets the seed for a new sequence of pseudo-random numbers to be returned by rand. These sequences are repeatable by calling srand with the same seed value.

randLimits ()

returns the lower and upper bound of the range of numbers that will be returned by rand.



last modified 2007/Mar/30 17:10