Re: [PATCH] rand.3: Clarify the lowest and highest return values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mark,

On Sun, Sep 12, 2010 at 3:30 PM, Mark Hills <mark@xxxxxxxxxxx> wrote:
> Commit 7155eb9 gives the range of return values, but the definition
> of 'range' is unclear. Indicate clearly that RAND_MAX is included in
> the set of possible return values.
>
> Signed-off-by: Mark Hills <mark@xxxxxxxxxxx>
> ---
>  man3/rand.3 |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/man3/rand.3 b/man3/rand.3
> index e65e69e..d1e14d8 100644
> --- a/man3/rand.3
> +++ b/man3/rand.3
> @@ -35,7 +35,7 @@
>  .\"          with contribution from Francesco Potorti <F.Potorti@xxxxxxxxxxxx>
>  .\" Modified 2003-11-15, aeb, added rand_r
>  .\"
> -.TH RAND 3 2008-08-29 "" "Linux Programmer's Manual"
> +.TH RAND 3 2010-09-12 "" "Linux Programmer's Manual"
>  .SH NAME
>  rand, rand_r, srand \- pseudo-random number generator
>  .SH SYNOPSIS
> @@ -59,8 +59,8 @@ _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE
>  .SH DESCRIPTION
>  The
>  .BR rand ()
> -function returns a pseudo-random integer in
> -the range [0,\ \fBRAND_MAX\fR].
> +function returns a pseudo-random integer between 0
> +and \fBRAND_MAX\fR (inclusive).
>  .PP
>  The
>  .BR srand ()
> --
> 1.7.1

The "[x..y]" notation in mathematics is used to express an inclusive
range, so I don't want to eliminate that notation. But I agree that
not everyone may be aware of this deail. I made the change below.

Thanks,

Michael

diff --git a/man3/rand.3 b/man3/rand.3
index 4587c8b..fdd2b70 100644
--- a/man3/rand.3
+++ b/man3/rand.3
@@ -60,7 +60,9 @@ _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE
 The
 .BR rand ()
 function returns a pseudo-random integer in
-the range [0,\ \fBRAND_MAX\fR].
+the range 0 to
+.BR RAND_MAX
+inclusive (i.e., the mathematical range [0,\ \fBRAND_MAX\fR]).
 .PP
 The
 .BR srand ()



-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux