home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mod201j.zip / modula2.exe / os2src / random.def < prev    next >
Text File  |  1995-07-30  |  1KB  |  49 lines

  1. DEFINITION MODULE Random;
  2. (*
  3.     Title     : An implementation of pseudo random numbers
  4.     Author    : I.R. Matters (Ian.Matters@anu.edu.au)
  5.     System    : Juergen Neuhoff's Modula-2 compiler on OS/2
  6.     Version   : 1.00
  7.     Last Edit : 30 July 1995
  8. *)
  9.  
  10.  
  11. VAR Seed : REAL;  (* The random number generator seed value.
  12.                      Initialized to 4.0 by Random module.
  13.                   *)
  14.  
  15. PROCEDURE Randomize;
  16. (*
  17.   Initialize the random number generator
  18.   seed with a pseudo-random value.
  19. *)
  20.  
  21.  
  22. PROCEDURE RandomReal(): REAL;
  23. (*
  24.    Return a random number in the range 0.0 <= RandomReal < 1.0 
  25. *)
  26.  
  27.  
  28. PROCEDURE RandomGaussReal(): REAL;
  29. (*
  30.    Return a random number with a Gaussian distribution
  31.    in the range 0.0 <= RandomGaussReal < 1.0 
  32. *)
  33.  
  34.  
  35. PROCEDURE RandomCard (Range: CARDINAL): CARDINAL;
  36. (*
  37.    Return a random number in the range 0 <= RandomCard < Range 
  38. *)
  39.  
  40.  
  41. PROCEDURE RandomGaussCard (Range: CARDINAL): CARDINAL;
  42. (*
  43.    Return a random number with a Gaussian distribution
  44.    in the range 0 <= RandomGaussCard < Range 
  45. *)
  46.  
  47.  
  48. END Random.
  49.