delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/04/30/15:18:51

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Mon, 30 Apr 2001 14:03:50 -0400
Message-Id: <200104301803.OAA16853@envy.delorie.com>
X-Authentication-Warning: envy.delorie.com: dj set sender to dj AT envy DOT delorie DOT com using -f
From: DJ Delorie <dj AT delorie DOT com>
To: HRahman10 AT aol DOT com
CC: cygwin AT cygwin DOT com
In-reply-to: <32.143dcec3.281efce6@aol.com> (HRahman10@aol.com)
Subject: Re: Random Number Generator
References: <32 DOT 143dcec3 DOT 281efce6 AT aol DOT com>

Sorry, fails on Linux also.  After fixing the bugs in your program
(missing stdio.h and stdlib.h) gcc complains about this:

r.c: In function `main':
r.c:11: warning: integer overflow in expression

rand() may return values close to the maximum allowable integer.
Multiplying them by 10 may cause overflow.  And, RAND_MAX+1 may not be
a valid integer (on Linux, RAND_MAX is INT_MAX, so RAND_MAX+1 is a
very negative number).

In short, your logic is flawed and the fact that it works "at
university" is pure coincidence.

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019