rand() man-page ambiguous or bug in glibc?

Folkert van Heusden folkert@vanheusden.com
Tue Apr 29 17:40:00 GMT 2008


> > The man-page says:
> >        The rand() function returns a pseudo-random integer between 0
> >        and RAND_MAX.
> > "Between" says me that neither 0 or RAND_MAX should be returned but a
> > simple test-program tells me otherwise.
> >
> > #include <stdio.h>
> > #include <stdlib.h>
> > int main(int argc, char *argv[]){for(;;){long long int dummy=rand(); if
> > (dummy == 0 || dummy == RAND_MAX)printf("value is %d\n", dummy);} return
> > 0;}
> >
> > So what is it?
> 
> Folkert,
> I already responded to the earlier version of this report, and
> described to you the fix for the man page (the evidence of your
> program is correct; the man page was badly worded).  I'm not sure why
> you are sending this message again?!

I'm very sorry, I missed it! Mea culpa.


Folkert van Heusden

-- 
Multi tail barnamaj mowahib li mora9abat attasjilat wa nataij awamir
al 7asoub. damj, talwin, mora9abat attarchi7 wa ila akhirih.
http://www.vanheusden.com/multitail/
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com



More information about the Libc-help mailing list