home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / random / randoms / random.doc < prev    next >
Encoding:
Text File  |  1988-10-31  |  2.8 KB  |  54 lines

  1.               Minimal Standard Random Number Generators
  2.  
  3. In a recent article in the "Communications of the ACM", Stephen Park and
  4. Keith Miller discuss the  need  for  good,  portable  industry  standard
  5. random number generators  and  describe the implementation of a  minimal
  6. standard random number generator which produces a very long sequence  of
  7. statistically independent random numbers uniformly distributed over  the
  8. range of 0.0 and 1.0.  They go on to discuss the theory of prime modulus
  9. multiplicative linear congruential generators and discuss a sampling  of
  10. inadequate generators, including IBM's  infamous  RANDU  and  the  Turbo
  11. Pascal [Version ?] generator.
  12.  
  13. Park and Miller's minimal standard random number generator has a  period
  14. of 2,147,483,646 (2^31-2) numbers.   By using an  algorithm  by  Schrage
  15. which avoids potential numeric overflow problems, their algorithm can be
  16. implemented in high level languages for any computer which  uses  32-bit
  17. integers and still achieve this period.   Previously,  one had to resort
  18. to assembly language coding to achieve long periods without aborting due
  19. to overflow and such coding is highly machine-dependent.  The high level
  20. implementations are machine-independent and portable.
  21.  
  22. This package consists of implementations of Park  and  Miller's  minimal
  23. standard random number generator  in  Turbo C V1.5,  FORTRAN-77  and  in
  24. Turbo Pascal (V4.0).
  25.  
  26.         RANDOM.C   is the generator written in Turbo C V1.5.  It returns
  27.                    a double-precision number in the range of 0.0 to 1.0.
  28.                    RANDOM.C  requires that "seed" be declared  a  global
  29.                    "long int" variable and that it be initialized by the
  30.                    main routine before it is called.
  31.  
  32.         RANDOM.FOR is the generator written in standard FORTRAN-77.   It
  33.                    returns a REAL number in the range  of  0.0  to  1.0.
  34.                    The seed is defined in BLOCK DATE RANSEE and  can  be
  35.                    initialized by calling subroutine SETRAN.
  36.  
  37.         RANDOM.PAS is the generator written in Turbo  Pascal  V4.0.   It
  38.                    returns a REAL number in the  range  of  0.0  to 1.0.
  39.                    RANDOM.PAS requires that SEED be  declared  a  global
  40.                    variable of type LONGINT and that it  be  initialized
  41.                    by the main procedure before RANDOM is called.
  42.  
  43. I would appreciate your comments on, or additions to, this package.
  44.  
  45. Harry M. Murphy, Consultant
  46. 3912 Hilton Avenue, NE
  47. Albuquerque, NM  87110
  48. Tel: (505) 881-0519
  49. 31 October 1988.
  50.  
  51. Reference:  Park, Stephen K., &  Miller, Keith W., "Random Number Gener-
  52. ators:  Good Ones are Hard to Find",  in  "Communications of  the  ACM",
  53. Vol. 31,  No. 10 (October 1988),  pp 1192 - 1201.
  54.