Hi, ...a potential quick commit for someone. :-)
What's the concesus that arc4random() should be a drop-in replacement for rand()/random()? Consider the following that caclulates the average of a bunch of random numbers on [0.0, 1.0]: bash$ cat rand.c #include <stdlib.h> int i; double avg; #define ITERATIONS 1000000 #define FIND_AVG(func) do { \ for (i=0, avg = 0.0; i<ITERATIONS; i++) \ avg += (double)func()/(double)RAND_MAX; \ printf("avg:\t%f\n", avg/ITERATIONS); \ } while (0) int main() { FIND_AVG(rand); FIND_AVG(random); FIND_AVG(arc4random); return 0; } bash$ cc rand.c && ./a.out avg: 0.500404 avg: 0.500007 avg: 1.001370 <--- !!!!!! bash$ uname -r 4.7-STABLE bash$ Is is just understood that arc4random() doesn't obey RAND_MAX, or should it? Whatever the answer is, perhaps the manpage should state what the range is like the manpages for rand(3) and random(3) do. -Paul. To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message