summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2004-05-09 06:07:43 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2004-05-09 06:07:43 +0000
commit138e83855f63338bf2b1a5826360c24c1afd7d1d (patch)
tree5f82c7ce33cd0f06c4cc27a5b477a2debe3e08b7 /bin
parent23d32038c454aebfcf199160132412aaa53a7d26 (diff)
Document new behavior of $RANDOM. ok deraadt@
Diffstat (limited to 'bin')
-rw-r--r--bin/ksh/ksh.121
-rw-r--r--bin/ksh/ksh.1tbl21
2 files changed, 30 insertions, 12 deletions
diff --git a/bin/ksh/ksh.1 b/bin/ksh/ksh.1
index 29624ce5387..e6ec2c7025d 100644
--- a/bin/ksh/ksh.1
+++ b/bin/ksh/ksh.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ksh.1,v 1.69 2004/04/30 06:57:17 jmc Exp $
+.\" $OpenBSD: ksh.1,v 1.70 2004/05/09 06:07:42 otto Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -1557,14 +1557,23 @@ May be unset or
.Dv NULL
if the shell doesn't know where it is.
.It Ev RANDOM
-A simple random number generator.
+A random number generator.
Every time
.Ev RANDOM
-is referenced, it is assigned the next number in a random number series.
-The point in the series can be set by assigning a number to
+is referenced, it is assigned the next random number in the range
+0\-32767.
+By default,
+.Xr arc4random 3
+is used to produce values.
+If the variable
.Ev RANDOM
-(see
-.Xr rand 3 ) .
+is assigned a value, the value is used as seed to
+.Xr srand 3
+and subsequent references of
+.Ev RANDOM
+will use
+.Xr rand 3
+to produce values, resulting in a predictable sequence.
.It Ev REPLY
Default parameter for the
.Ic read
diff --git a/bin/ksh/ksh.1tbl b/bin/ksh/ksh.1tbl
index 7a925f2e39b..dfe71bb29cc 100644
--- a/bin/ksh/ksh.1tbl
+++ b/bin/ksh/ksh.1tbl
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ksh.1tbl,v 1.69 2004/04/30 06:57:17 jmc Exp $
+.\" $OpenBSD: ksh.1tbl,v 1.70 2004/05/09 06:07:42 otto Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -1557,14 +1557,23 @@ May be unset or
.Dv NULL
if the shell doesn't know where it is.
.It Ev RANDOM
-A simple random number generator.
+A random number generator.
Every time
.Ev RANDOM
-is referenced, it is assigned the next number in a random number series.
-The point in the series can be set by assigning a number to
+is referenced, it is assigned the next random number in the range
+0\-32767.
+By default,
+.Xr arc4random 3
+is used to produce values.
+If the variable
.Ev RANDOM
-(see
-.Xr rand 3 ) .
+is assigned a value, the value is used as seed to
+.Xr srand 3
+and subsequent references of
+.Ev RANDOM
+will use
+.Xr rand 3
+to produce values, resulting in a predictable sequence.
.It Ev REPLY
Default parameter for the
.Ic read