#include #include #include "../rand.h" #define TIMES 10 void bsd1(void) { bsdsrand(1); for( int i = 0; i < TIMES; i++ ) { printf("%d\n", bsdrand()); } } void sys1(void) { unsigned ctx = 1; for( int i = 0; i < TIMES; i++ ) { printf("%d\n", rand_r(&ctx)); } } int main(int argc, char *argv[]) { printf("4.4BSD rand\n"); bsd1(); printf("sys rand_r\n"); sys1(); return 0; }