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



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


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