This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Random Number Generator


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@rfk.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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]