🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1577

Bug in gcc's rand() function.

#1577
From: David Charlap
Date: Mon, 04 Jan 1993 21:07
26 lines
1122 bytes
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
 ~|~
Technical Details
Message-ID: <1993Jan4.210729.28287@njitgw.njit.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!hertz.njit.edu!dic5340

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!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