home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #if __STDC__
- #include <stdlib.h>
- #include <unistd.h>
- #else
- #ifdef sun
- #define RAND_MAX 0x7fffffff
- #endif
- #endif
-
- #if !__STDC__
- long labs(x)
- long x;
- {
- return (x < 0)? -x : x;
- }
- #endif
-
- #ifdef __hpux
- #define random rand
- #else
- extern long random();
- #endif
-
- int main()
- {
- register long i, h, t;
- for (h = 0, t = 0, i = 0; i < 20000; i++)
- if(random() < (RAND_MAX/2))
- h++;
- else
- t++;
- if(labs(h-t) > 2)
- {
- printf("%ld %ld\n", h , t);
- return 1;
- }
- return 0;
- }
-