Hi Anton,

Anton Lindqvist wrote on Sun, Feb 19, 2017 at 08:29:31AM +0100:

> Usage of rand was replaced with arc4random (var.c, r1.17) and later
> documented (ksh.1, r1.70). The change was later on reverted (var.c,
> r1.39) back to using rand and srand_deterministic. The patch below
> removes the explicit mention of arc4random and documents the current
> behavior.

I think both the current text and your patch are wrong.

The current text says that srand(3) is used.
That, indeed, is not true, so thanks for the heads-up.

Your patch deletes a sentence that is actually true:
  "By default, arc4random(3) is used to produce values."
That is true because rand(3) uses arc4random(3) by default.
I think we should keep that information.  It tells people that
on OpenBSD, ksh(1) RANDOM is of decent quality by default.

So, here is my suggestion.  I don't think we need to say that ksh(1)
calls arc4random(3) indirectly via rand(3).  From the perspective
of ksh(1) users, that's an implementation detail.

OK?
  Ingo


Index: ksh.1
===================================================================
RCS file: /cvs/src/bin/ksh/ksh.1,v
retrieving revision 1.186
diff -u -r1.186 ksh.1
--- ksh.1       14 Nov 2016 06:59:42 -0000      1.186
+++ ksh.1       19 Feb 2017 17:20:31 -0000
@@ -1704,12 +1704,10 @@
 If the variable
 .Ev RANDOM
 is assigned a value, the value is used as the seed to
-.Xr srand 3
+.Xr srand_deterministic 3
 and subsequent references of
 .Ev RANDOM
-will use
-.Xr rand 3
-to produce values, resulting in a predictable sequence.
+produce a predictable sequence.
 .It Ev REPLY
 Default parameter for the
 .Ic read

Reply via email to