]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
random.3: Change "RAND_MAX" tp "2^31-1"
authorJohn Marshall <John.W.Marshall@glasgow.ac.uk>
Mon, 8 Jun 2020 11:04:16 +0000 (12:04 +0100)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Mon, 8 Jun 2020 21:09:36 +0000 (23:09 +0200)
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>
man3/random.3

index 76b076f4257107a05976161ca46cbb2cbd37b7fc..e3550f802887b763172fea3f130a641898ec1833 100644 (file)
@@ -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.