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

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
X-Lotus-FromDomain: JPMORGAN AT SMTP
From: "Noel L Yap" <yap_noel AT jpmorgan DOT com>
To: HRahman10 AT aol DOT com
cc: Cygwin AT Cygwin DOT Com
Message-ID: <85256A3E.00625EAC.00@nyc-ntgw-n01.ny.jpmorgan.com>
Date: Mon, 30 Apr 2001 13:54:30 -0400
Subject: Re: Random Number Generator
Mime-Version: 1.0

Did you include stdlib.h?

Noel




HRahman10 AT aol DOT com on 2001.04.30 13:37:42

To:   cygwin AT cygwin DOT com
cc:   (bcc: Noel L Yap)
Subject:  Random Number Generator




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!

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






This communication is for informational purposes only.  It is not intended as
an offer or solicitation for the purchase or sale of any financial instrument
or as an official confirmation of any transaction. All market prices, data
and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein
do not necessarily reflect those of J.P. Morgan Chase & Co., its
subsidiaries and affiliates.


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