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

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
Message-Id: <4.3.1.2.20010430141203.01659b48@pop.ma.ultranet.com>
X-Sender: lhall AT pop DOT ma DOT ultranet DOT com
X-Mailer: QUALCOMM Windows Eudora Version 4.3.1
Date: Mon, 30 Apr 2001 14:13:08 -0400
To: HRahman10 AT aol DOT com
From: "Larry Hall (RFK Partners, Inc)" <lhall AT rfk DOT com>
Subject: Re: Random Number Generator
Cc: cygwin AT cygwin DOT com
In-Reply-To: <32.143dcec3.281efce6@aol.com>
Mime-Version: 1.0

At 01:37 PM 4/30/2001, you wrote:
>Hi!, I'm writing a program using the random number genrator rand() defined in <stdlib.h>.  I've written the following program to test it: 
>
>
>
>void main()
>{
>   int input1, i;
>
>   srand(time(NULL));
>   
>   for (i=0; i<20 ; i++)
>     {
>       input1 = rand() * 10 / (RAND_MAX + 1);
>       printf("random numbers %i\n",input1);
>
>     }
>} 
>
>
>BUT, the results I get are all zeros.  Is there something wrong with the gcc compiler provided by cygwin, because I've tested this program at university, and it outputs random numbers correctly.
>
>Please Help!
>
>Thank You!



Try the latest snapshot at www.cygwin.com.



Larry Hall                              lhall AT rfk DOT com
RFK Partners, Inc.                      http://www.rfk.com
118 Washington Street                   (508) 893-9779 - RFK Office
Holliston, MA 01746                     (508) 893-9889 - FAX


--
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