List of Import References :
See BOOL
See Com
See DENOTATION
See Nat
See Option
See Real
See Seq
See Void
SIGNATURE Random
$Date: 2010-09-30 18:24:17 +0200 (Do, 30. Sep 2010) $ ($Revision: 616 $)
-- pseudo random numbers
-- uses the "minimal standard" from Park and Miller
-- see "Random Number Generators: Good Ones are Hard to Find",
-- Comm. ACM, Vol. 31, No. 10, pp. 1192 - 1201
IMPORT Com[nat] ONLY com
Com[real] ONLY com
Com[void] ONLY com
Nat ONLY nat
Real ONLY real
Void ONLY void
FUN seed? : com[real] -- return current seed value
-- natural number, but may exceed max'Nat
FUN seed : real -> com[void] -- set seed
-- seed is initialized differently
-- for every program call
FUN random : com[real] -- uniformly distributed pseudo random numbers
-- between 0 and 1
FUN random : nat -> com[nat] -- as above, then
-- multiply real by argument and convert to nat
-- thus returns number from 0 to arg-1
FUN random : com[nat] -- as above, with max'Nat as argument
next node: ComAction,
prev node: ComState,
up to node: Subsystem Commands