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?


Eus wrote:
Dear Michael,

On Tue, Apr 29, 2008 at 4:29 PM, "Michael Kerrisk" <mtk.manpages@googlemail.com> wrote:

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?!

If you do not mind, would you please resend the described fix to this mailing list? It will certainly help me and others who would like to make the man pages better.

Thank you very much.

Cheers,

Michael

Best regards, Eus





here it is


---------- Forwarded message ----------
From: Michael Kerrisk <mtk.manpages@googlemail.com>
Date: Mon, Apr 28, 2008 at 10:28 PM
Subject: Re: rand() man-page ambiguous or bug in glibc?
To: Folkert van Heusden <folkert@vanheusden.com>
Cc: glibc-sc@gnu.org, mtk.manpages@gmail.com, udovdh@xs4all.nl


Hello Folkert,


What interest does the glibc steering committee have in this bug report?

On Mon, Apr 28, 2008 at 8:00 PM, 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.

Yes -- it is indeed poorly worded.

> #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;}

At this time, I'm not taking entries for the IOCCC...

Anyway, I have changed the text to say:

"returns an integer in the range [0, RAND_MAX]"


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