From: utzoo!decvax!harpo!eagle!mhuxt!mhuxa!mhb5b!smb Newsgroups: net.bugs.4bsd Title: Re: Bug in random number generator Article-I.D.: mhb5b.232 Posted: Thu Mar 24 13:46:49 1983 Received: Fri Mar 25 21:37:28 1983 References: <191@ritcv.UUCP> As Knuth points out (Art of Computer Programming, Vol. 2 -- Seminumerical Algorithms) the low-order bits of *any* linear congruential random number generator are not particularly random. The proper way to view the output is as a fraction between 0 and 1. Thus, to get a random bit, one should never take rand()%2; rather, one should use rand() > (MAXINT/2) (or some such). Of course, none of this means that rand() is a good random number generator -- it's not. --Steve