This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On Tue, Apr 29, 2008 at 11:26 AM, Folkert van Heusden
<folkert@vanheusden.com> wrote:
> Hi,
>
> 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?!

Cheers,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html


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