home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / BC_RAND.H < prev    next >
C/C++ Source or Header  |  1997-07-05  |  502b  |  19 lines

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /*
  4. **  Port Borland random() and randomize() functions to other compilers
  5. */
  6.  
  7. #ifndef BC_RAND__H
  8. #define BC_RAND__H
  9.  
  10. #include <stdlib.h>           /* For RAND_MAX, NULL, rand() and srand() */
  11. #include <time.h>             /* For time()                             */
  12.  
  13. #ifndef __TURBOC__
  14.  #define random(num) (int)(((rand())*(long)(num))/(((long)RAND_MAX)+1))
  15.  #define randomize() srand((unsigned)time(NULL)|1)
  16. #endif
  17.  
  18. #endif /* BC_RAND__H */
  19.