home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.gcc.bug
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!hertz.njit.edu!dic5340
- From: dic5340@hertz.njit.edu (David Charlap)
- Subject: Bug in gcc's rand() function.
- Message-ID: <1993Jan4.210729.28287@njitgw.njit.edu>
- Sender: gnulists@ai.mit.edu
- Organization: New Jersey Institute of Technology, Newark, N.J.
- Distribution: gnu
- Date: Mon, 4 Jan 1993 21:07:29 GMT
- Approved: bug-gcc@prep.ai.mit.edu
- Lines: 27
-
- When the stdlib.h rand() function is called, the sequence is
- repeatable, mod 8.
-
- For example, the following code:
-
- #include <stdio.h>
- #include <stdlib.h>
-
- main() {
- int x;
-
- for (x=0; x<100; x++)
- printf ("%d ", rand() % 8);
- }
-
- 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.
- --
- |) David Charlap | .signature confiscated by FBI due to
- /|_ dic5340@hertz.njit.edu | an ongoing investigation into the
- ((|,) | source of these .signature virusses
- ~|~
-
-