signature MLTON_RANDOM =
sig
val alphaNumChar: unit -> char
val alphaNumString: int -> string
val rand: unit -> word
val seed: unit -> word option
val srand: word -> unit
val useed: unit -> word option
end
-
alphaNumChar ()
returns a random alphanumeric character.
-
alphaNumString n
returns a string of length
n
of random alphanumeric characters. -
rand ()
returns the next pseudo-random number.
-
seed ()
returns a random word from
/dev/random
. Useful as an arg tosrand
. If/dev/random
can not be read from,seed ()
returnsNONE
. A call toseed
may block until enough random bits are available. -
srand w
sets the seed used by
rand
tow
. -
useed ()
returns a random word from
/dev/urandom
. Useful as an arg tosrand
. If/dev/urandom
can not be read from,useed ()
returnsNONE
. A call touseed
will never block — it will instead return lower quality random bits.