home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
pmos2002.zip
/
DEF
/
RANDCARD.DEF
< prev
next >
Wrap
Text File
|
1996-10-08
|
1KB
|
31 lines
DEFINITION MODULE RandCard;
(********************************************************)
(* *)
(* Random number generator *)
(* *)
(* Programmer: P. Moylan *)
(* Last edited: 25 June 1996 *)
(* Status: OK *)
(* *)
(********************************************************)
CONST modulus = 2147483647; (* 2^31 - 1 *)
VAR seed: CARDINAL; (* visible in case you want to re-randomize *)
PROCEDURE RandCardinal (): CARDINAL;
(* Returns a random number in the range [1..modulus-1], with a *)
(* uniform distribution over that range. *)
PROCEDURE RandInt (min, max: INTEGER): INTEGER;
(* Returns a random number in the range [min..max] *)
(* (inclusive), with an approximately uniform distribution *)
(* over that range. (In this version I'm not being fussy *)
(* about the precise distribution.) *)
END RandCard.