home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / src / out-of-phase-102-c / OutOfPhase 1.02 Source / OutOfPhase Folder / Level 1 Extensions 29Sep94 / RandomNumbers.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-23  |  1.6 KB  |  42 lines  |  [TEXT/KAHL]

  1. /* RandomNumbers.h */
  2.  
  3. #ifndef Included_RandomNumbers_h
  4. #define Included_RandomNumbers_h
  5.  
  6. /* RandomNumbers module depends on */
  7. /* MiscInfo.h */
  8. /* Audit */
  9. /* Debug */
  10. /* Definitions */
  11.  
  12. #define PARKANDMILLERMINIMUM (1L)
  13. #define PARKANDMILLERMAXIMUM (2147483646L)
  14.  
  15. /* this implements the Park and Miller (Communications of the ACM, 1988) Minimal */
  16. /* Standard random number generator. it returns a number in the range [1..2147483646] */
  17. long                            ParkAndMillerRandom(void);
  18.  
  19. /* set the Park and Miller random number seed.  it returns the old seed so that */
  20. /* multiple clients can save and restore the seed so they don't interfere with */
  21. /* each other.  the seed must be in the range [1..2147483646]. */
  22. long                            SetParkAndMillerRandomSeed(long NewSeed);
  23.  
  24.  
  25. #define LECUYERMINIMUM (1L)
  26. #define LECUYERMAXIMUM (2147483562L)
  27.  
  28. /* this implements the L'Ecuyer (Communications of the ACM, 1988) hybrid 32-bit */
  29. /* random number generator.  it returns a value in the range [1..2147483562] */
  30. /* WARNING:  no test data or algorithm was supplied in the article, so the */
  31. /* correctness of this implementation can not be guarranteed. */
  32. long                            LEcuyerRandom(void);
  33.  
  34. /* sets the LEcuyer seeds.  the first seed must be in the range [1..2147483562] */
  35. /* and the second seed in the range [1..2147483398].  the previous are returned */
  36. /* so that multiple clients can save and restore seeds without interfering with */
  37. /* each other.  the pointers may be NIL if the old seeds values are not needed. */
  38. void                            SetLEcuyerRandomSeed(long NewS1, long NewS2, long* OldS1Out,
  39.                                         long* OldS2Out);
  40.  
  41. #endif
  42.