Random Number Generator

DJ Delorie dj@delorie.com
Mon Apr 30 11:35:00 GMT 2001


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



More information about the Cygwin mailing list