home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff262.lzh / Lotto / rand.c < prev    next >
Text File  |  1989-10-31  |  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.