Page MenuHomeFreeBSD

D29385.id86177.diff
No OneTemporary

D29385.id86177.diff

Index: share/man/man9/random.9
===================================================================
--- share/man/man9/random.9
+++ share/man/man9/random.9
@@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\" "
-.Dd December 26, 2019
+.Dd March 22, 2021
.Dt RANDOM 9
.Os
.Sh NAME
@@ -132,17 +132,12 @@
returned.
.Pp
The deprecated
-.Xr random 9
-function will produce a sequence of pseudorandom numbers using a similar weak
-linear congruential generator as
-.Xr rand 3
-(the 1988 Park-Miller LCG).
+.Fn random
+function will return a 31-bit value.
It is obsolete and scheduled to be removed in
-.Fx 13.0 .
-It is strongly advised that the
-.Xr random 9
-function not be used to generate random numbers.
-See
+a future version, see
+.Xr prng 9
+and see
.Sx SECURITY CONSIDERATIONS .
.Sh RETURN VALUES
The
@@ -167,6 +162,13 @@
.Fn read_random_uio
returns zero when successful,
otherwise an error code is returned.
+.Pp
+.Fn random
+returns numbers
+in the range from 0 to
+.if t 2\u\s731\s10\d\(mi1.
+.if n (2**31)\(mi1.
+
.Sh ERRORS
.Fn read_random_uio
may fail if:
Index: sys/libkern/random.c
===================================================================
--- sys/libkern/random.c
+++ sys/libkern/random.c
@@ -45,5 +45,5 @@
u_long
random(void)
{
- return (prng32());
+ return (prng32() & 0x7fffffff);
}

File Metadata

Mime Type
text/plain
Expires
Thu, May 1, 11:32 AM (15 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17880328
Default Alt Text
D29385.id86177.diff (1 KB)

Event Timeline