mirror of https://github.com/mkerrisk/man-pages
random.3: Change "RAND_MAX" tp "2^31-1"
RAND_MAX is for rand(3). POSIX fixes random()'s range at 2^31-1; RAND_MAX may be smaller on some platforms (even though with glibc or musl on Linux they are the same). Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
e9898cc8ba
commit
2de361c8e9
|
@ -69,7 +69,7 @@ The
|
|||
function uses a nonlinear additive feedback random
|
||||
number generator employing a default table of size 31 long integers to
|
||||
return successive pseudo-random numbers in
|
||||
the range from 0 to \fBRAND_MAX\fR.
|
||||
the range from 0 to 2^31\ \-\ 1.
|
||||
The period of this random number generator is very large, approximately
|
||||
.IR "16\ *\ ((2^31)\ \-\ 1)" .
|
||||
.PP
|
||||
|
@ -125,7 +125,9 @@ or be the result of a previous call of
|
|||
The
|
||||
.BR random ()
|
||||
function returns a value between 0 and
|
||||
.BR RAND_MAX .
|
||||
.BR INT32_MAX ,
|
||||
i.e.,
|
||||
.IR "(2^31)\ \-\ 1" .
|
||||
The
|
||||
.BR srandom ()
|
||||
function returns no value.
|
||||
|
|
Loading…
Reference in New Issue