diff options
author | deraadt <> | 2021-02-12 17:03:51 +0000 |
---|---|---|
committer | deraadt <> | 2021-02-12 17:03:51 +0000 |
commit | 8d0019e0ef2b64cb2c762a1b3515a73c2f3c95ac (patch) | |
tree | 08bf1b5a12da10f3514cc2b72e242eb044157261 /src | |
parent | 97774d9c27b0207d237875ef6677e2507d9a084a (diff) | |
download | openbsd-8d0019e0ef2b64cb2c762a1b3515a73c2f3c95ac.tar.gz openbsd-8d0019e0ef2b64cb2c762a1b3515a73c2f3c95ac.tar.bz2 openbsd-8d0019e0ef2b64cb2c762a1b3515a73c2f3c95ac.zip |
Some people still argue that rand(3) and random(3) have suitable deterministic
use cases, so explain the situation a bit more. Since the 80's, I estimate
around 5 algorithm changes, so any chosen seed is unrepeatable UB.
+The deterministic sequence algorithm changed a number of times since
+original development, is underspecified, and should not be relied upon to
+remain consistent between platforms and over time.
ok jmc kettenis
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libc/stdlib/rand.3 | 7 | ||||
-rw-r--r-- | src/lib/libc/stdlib/random.3 | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/lib/libc/stdlib/rand.3 b/src/lib/libc/stdlib/rand.3 index 2fd88ac8a4..76278c871a 100644 --- a/src/lib/libc/stdlib/rand.3 +++ b/src/lib/libc/stdlib/rand.3 | |||
@@ -29,9 +29,9 @@ | |||
29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
30 | .\" SUCH DAMAGE. | 30 | .\" SUCH DAMAGE. |
31 | .\" | 31 | .\" |
32 | .\" $OpenBSD: rand.3,v 1.19 2014/12/09 21:55:39 jmc Exp $ | 32 | .\" $OpenBSD: rand.3,v 1.20 2021/02/12 17:03:51 deraadt Exp $ |
33 | .\" | 33 | .\" |
34 | .Dd $Mdocdate: December 9 2014 $ | 34 | .Dd $Mdocdate: February 12 2021 $ |
35 | .Dt RAND 3 | 35 | .Dt RAND 3 |
36 | .Os | 36 | .Os |
37 | .Sh NAME | 37 | .Sh NAME |
@@ -78,6 +78,9 @@ can be substituted for | |||
78 | then subsequent | 78 | then subsequent |
79 | .Fn rand | 79 | .Fn rand |
80 | calls will return results using the deterministic algorithm. | 80 | calls will return results using the deterministic algorithm. |
81 | The deterministic sequence algorithm changed a number of times since | ||
82 | original development, is underspecified, and should not be relied upon to | ||
83 | remain consistent between platforms and over time. | ||
81 | .Pp | 84 | .Pp |
82 | The | 85 | The |
83 | .Fn rand | 86 | .Fn rand |
diff --git a/src/lib/libc/stdlib/random.3 b/src/lib/libc/stdlib/random.3 index 020c72805f..0770d20f09 100644 --- a/src/lib/libc/stdlib/random.3 +++ b/src/lib/libc/stdlib/random.3 | |||
@@ -25,9 +25,9 @@ | |||
25 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 25 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
26 | .\" SUCH DAMAGE. | 26 | .\" SUCH DAMAGE. |
27 | .\" | 27 | .\" |
28 | .\" $OpenBSD: random.3,v 1.28 2014/12/09 21:55:39 jmc Exp $ | 28 | .\" $OpenBSD: random.3,v 1.29 2021/02/12 17:03:51 deraadt Exp $ |
29 | .\" | 29 | .\" |
30 | .Dd $Mdocdate: December 9 2014 $ | 30 | .Dd $Mdocdate: February 12 2021 $ |
31 | .Dt RANDOM 3 | 31 | .Dt RANDOM 3 |
32 | .Os | 32 | .Os |
33 | .Sh NAME | 33 | .Sh NAME |
@@ -96,6 +96,9 @@ a default table of size 31 long integers to return successive pseudo-random | |||
96 | numbers in the range from 0 to (2**31)\-1. | 96 | numbers in the range from 0 to (2**31)\-1. |
97 | The period of this random number generator is very large, approximately | 97 | The period of this random number generator is very large, approximately |
98 | 16*((2**31)\-1), but the results are a deterministic sequence from the seed. | 98 | 16*((2**31)\-1), but the results are a deterministic sequence from the seed. |
99 | The deterministic sequence algorithm changed a number of times since | ||
100 | original development, is underspecified, and should not be relied upon to | ||
101 | remain consistent between platforms and over time. | ||
99 | .Pp | 102 | .Pp |
100 | The | 103 | The |
101 | .Fn initstate | 104 | .Fn initstate |