Bug in rand() and srand()

Alexis Dimitriadis alexis at reed.UUCP
Sat Mar 9 12:34:03 AEST 1985


> A better way around the problem is to use the more
> sophisticated random number generator random() all of its bits are supposed
> to be random and its really not that much slower than rand().  A simple
> #define rand random can fix your code.

  Our version of 4.2 random() ALWAYS returns an even number the first time it
is called after being seeded. That effectively breaks small applications
that call random only once.  (Or those that seed it for every call).

  	alexis



More information about the Comp.lang.c mailing list