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 manpages at googlemail dot com>
- To: "Folkert van Heusden" <folkert at vanheusden dot com>
- Cc: libc-help at sourceware dot org, udovdh at xs4all dot nl
- Date: Tue, 29 Apr 2008 11:29:59 +0200
- Subject: Re: rand() man-page ambiguous or bug in glibc?
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=jeJFBUBb/6yo84Hvm2j1EEvF7U3TEV6ZkWIg+WWBm7o=; b=fH24HRB9QqXbeREitkVk0pTT7m2iRPx5KW6EmqKZ4+BI3z2MJONM9B6aR3e5RKEclA5dbAUKgSxXDabORoCAvStycnWKfaWmXDL9DbnuvGz6XYSlV8uElcP8TpqK3efT+gombdYJ7mx2/ENn6K59eK5L6jbZQsyVC0x+C0jSVmk=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=L9gTJQ1NEkJg1SfccAUNZ66T8axoziu7Vi+0QF3CxdTKd3L9sc1BQXNbzG+ITUKvnxQ1SoOi/EW7qoSfhdmwP1hKLqKkjn1vc+OxNiucR0b3+l5RgBwKvDLZsS4evLEIhRRWKzBTZv+taznw72i3uBST6zAl7F/kCVDxwENBzlg=
- References: <20080429092615.GV12113@vanheusden.com>
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