Bug in rand() and srand()

Peter S. Shenkin peters at cubsvax.UUCP
Sat Mar 2 02:15:44 AEST 1985


In attempting to use these functions under 4.1bsd on a VAX/780, I found that
rand() returns strictly alternating even and odd numbers, regardless of
seed!!!  So I went and tried the same thing on a 4.2bsd system, and found
the same behavior.  

It may be that this has already been hashed out in some
of the above newsgroups, but since I only read net.lang.c among them I will
have missed the discussion.  If anyone has a rewritten rand(), or other
advice, I'd appreciate being mailed a fix.

Thanks,  Peter S. Shenkin,   {philabs,cmcl2!rna}!cubsvax!peters



More information about the Comp.lang.c mailing list