home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / gnu / gcc / bug / 3119 < prev    next >
Encoding:
Text File  |  1993-01-06  |  1.7 KB  |  48 lines

  1. Newsgroups: gnu.gcc.bug
  2. Path: sparky!uunet!spool.mu.edu!uwm.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!hertz.njit.edu!dic5340
  3. From: dic5340@hertz.njit.edu (David Charlap)
  4. Subject: Re: Bug in gcc's rand() function.
  5. Message-ID: <1993Jan5.214231.29669@njitgw.njit.edu>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: New Jersey Institute of Technology, Newark, N.J.
  8. References: <1993Jan4.210729.28287@njitgw.njit.edu>
  9. Distribution: gnu
  10. Date: Tue, 5 Jan 1993 21:42:31 GMT
  11. Approved: bug-gcc@prep.ai.mit.edu
  12. Lines: 34
  13.  
  14. In article <1993Jan4.210729.28287@njitgw.njit.edu> dic5340@hertz.njit.edu (David Charlap) writes:
  15. >When the stdlib.h rand() function is called, the sequence is
  16. >repeatable, mod 8.
  17. >
  18. >For example, the following code:
  19. >
  20.     [deleted]
  21. >
  22. >always produces the following repeating sequence:
  23. >
  24. >    6   7   4   5   2   3   0   1
  25. >
  26. >I have tested it on the OS/2 2.0 port of gcc and the Dec-Ultrix
  27. >version, and I get the same result in both cases.
  28.  
  29. Thanks to all those who responded - you can stop the e-mail now!
  30.  
  31. To summarize, the problem isn't in gcc, but in the C library.  Since I
  32. work primarilly with OS/2, I am used to the non-Unix convention of
  33. shipping the library with the compiler, so I assumed both to be the
  34. same.  The OS/2 port of gcc includes a port of the library, and I
  35. mistakenly thought that this was a part of the gcc distribution.
  36.  
  37. Fortunately, in addition to porting the rand() bug, the author also
  38. ported the random() function which avoids the bug.  So there's to
  39. further problem.
  40.  
  41. Thanks to everyone who responded for helping me figure this out.
  42. -- 
  43.   |)  David Charlap          | .signature confiscated by FBI due to
  44.  /|_  dic5340@hertz.njit.edu | an ongoing investigation into the
  45. ((|,)                        | source of these .signature virusses
  46.  ~|~
  47.  
  48.