Article View: gnu.gcc.bug
Article #1587Re: Bug in gcc's rand() function.
From: David Charlap
Date: Tue, 05 Jan 1993 21:42
Date: Tue, 05 Jan 1993 21:42
33 lines
1824 bytes
1824 bytes
In article <1993Jan4.210729.28287@njitgw.njit.edu> dic5340@hertz.njit.edu (David Charlap) writes: >When the stdlib.h rand() function is called, the sequence is >repeatable, mod 8. > >For example, the following code: > [deleted] > >always produces the following repeating sequence: > > 6 7 4 5 2 3 0 1 > >I have tested it on the OS/2 2.0 port of gcc and the Dec-Ultrix >version, and I get the same result in both cases. Thanks to all those who responded - you can stop the e-mail now! To summarize, the problem isn't in gcc, but in the C library. Since I work primarilly with OS/2, I am used to the non-Unix convention of shipping the library with the compiler, so I assumed both to be the same. The OS/2 port of gcc includes a port of the library, and I mistakenly thought that this was a part of the gcc distribution. Fortunately, in addition to porting the rand() bug, the author also ported the random() function which avoids the bug. So there's to further problem. Thanks to everyone who responded for helping me figure this out. -- |) David Charlap | .signature confiscated by FBI due to /|_ dic5340@hertz.njit.edu | an ongoing investigation into the ((|,) | source of these .signature virusses ~|~
Technical Details
Message-ID:
<1993Jan5.214231.29669@njitgw.njit.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!uwm.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!hertz.njit.edu!dic5340References:
<1993Jan4.210729.28287@njitgw.njit.edu>Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!uwm.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!hertz.njit.edu!dic5340 From: dic5340@hertz.njit.edu (David Charlap) Subject: Re: Bug in gcc's rand() function. Message-ID: <1993Jan5.214231.29669@njitgw.njit.edu> Sender: gnulists@ai.mit.edu Organization: New Jersey Institute of Technology, Newark, N.J. References: <1993Jan4.210729.28287@njitgw.njit.edu> Distribution: gnu Date: Tue, 5 Jan 1993 21:42:31 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 34