home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 333.lha / Lotto / rand.c < prev    next >
Text File  |  1989-12-28  |  273b  |  21 lines

  1. /* rand.c - Eric Giguere - Transactor v2.6 */
  2.  
  3. static unsigned long next;
  4.  
  5. void srand(seed)
  6. unsigned long seed;
  7. {
  8.     next = seed;
  9. }
  10.  
  11. #define A 1664525L
  12. #define B 65536L
  13.  
  14. unsigned long rand(max)
  15. unsigned long max;
  16. {
  17.     next = A * next + 1L;
  18.  
  19.     return (((next / B) * max) / B);
  20. }
  21.