Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
  2. #include <stdlib.h>
  3.  
  4. static unsigned long long next = 0;
  5.  
  6. int
  7. rand(void)
  8. {
  9.   next = next * 1103515245L + 12345;
  10.   next = (next<<15) ^ (next >> 27);
  11.   return (int)((next >> 4) & RAND_MAX);
  12. }
  13.  
  14. void
  15. srand(unsigned seed)
  16. {
  17.   next = seed;
  18. }
  19.