This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: rand() man-page ambiguous or bug in glibc?
- From: Michael Kerrisk <mtk dot lists at gmail dot com>
- To: eus at member dot fsf dot org
- Cc: Michael Kerrisk <mtk dot manpages at googlemail dot com>, libc-help at sourceware dot org
- Date: Sun, 20 Jul 2008 18:26:36 +0200
- Subject: Re: rand() man-page ambiguous or bug in glibc?
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=3y0PupycvGYUpJ0Hjma1q1xWZRMAvK1Xs9fSOUuXBhw=; b=dszBEesP31Mr2YPpBcqncN//PBO+3KFULb8vPWM7Mcxc/tFQhPnf/Yvel8E7eCFDPY 6WQOil3XyMOP8KGNX2PicEH9Qm15DQ87ehqin2B5Yy3SmgCBTgPx6Ne1hcKKtMm6VkOy RiCwO22jBklQXa76Ue+cNSNyeIg+MigDn9nmk=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=HorXWekT7i8dDT5j2Dhxzx6UN3GOw/dWDs7an/FG2zNHJvM/uGYNkzG+cxJdIlmXtr WJNME2qLWEXF9pgcq9jL64Xz7b+kKoMktWhZE8BbZu9Wr3MJuPslGwTd1qTJV55txGJt CL6nbn9+7L57RkGGB6ctOqSHODkbuCv7rViMg=
- References: <524820.62302.qm@web37601.mail.mud.yahoo.com>
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]"