Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F115939954
D29385.id86214.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D29385.id86214.diff
View Options
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,13 @@
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
+.Fx 14.0 .
+Consider
+.Xr prng 9
+instead and see
.Sx SECURITY CONSIDERATIONS .
.Sh RETURN VALUES
The
@@ -167,6 +163,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
Details
Attached
Mime Type
text/plain
Expires
Thu, May 1, 4:20 PM (16 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17885786
Default Alt Text
D29385.id86214.diff (1 KB)
Attached To
Mode
D29385: Make random() behaves as documented: "result is uniform in [0, 2^31 - 1]"
Attached
Detach File
Event Timeline
Log In to Comment