summaryrefslogtreecommitdiffstats
path: root/doc/expr.n
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2003-01-03 23:03:22 (GMT)
committerdgp <dgp@users.sourceforge.net>2003-01-03 23:03:22 (GMT)
commitc471b0fb6cfe23fbec6d5ccdbd73b0f99e34da4d (patch)
tree2775a0d7b567eb28417d8571687bf5addca6581e /doc/expr.n
parentd07e1d0bce72877d8c8941adbae195f4f0fec3bd (diff)
downloadtcl-c471b0fb6cfe23fbec6d5ccdbd73b0f99e34da4d.zip
tcl-c471b0fb6cfe23fbec6d5ccdbd73b0f99e34da4d.tar.gz
tcl-c471b0fb6cfe23fbec6d5ccdbd73b0f99e34da4d.tar.bz2
Corrected and expanded documentation for rand() and srand() functions.
Diffstat (limited to 'doc/expr.n')
-rw-r--r--doc/expr.n17
1 files changed, 10 insertions, 7 deletions
diff --git a/doc/expr.n b/doc/expr.n
index f7d49d9..cdb6560 100644
--- a/doc/expr.n
+++ b/doc/expr.n
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: expr.n,v 1.9 2002/07/01 18:24:39 jenglish Exp $
+'\" RCS: @(#) $Id: expr.n,v 1.10 2003/01/03 23:03:22 dgp Exp $
'\"
.so man.macros
.TH expr n 8.4 Tcl "Tcl Built-In Commands"
@@ -280,10 +280,13 @@ Computes the value of \fIx\fR raised to the power \fIy\fR. If \fIx\fR
is negative, \fIy\fR must be an integer value.
.TP
\fBrand()\fR
-Returns a floating point number from zero to just less than one or, in
-mathematical terms, the range [\fI0\fR,\fI1\fR). The seed comes from
-the internal clock of the machine or may be set manual with the
-\fBsrand\fR function.
+Returns a pseudo-random floating point value in the range (\fI0\fR,\fI1\fR).
+The generator algorithm is a simple linear congruential generator that
+is not cryptographically secure. Each result from \fBrand\fR completely
+determines all future results from subsequent calls to \fBrand\fR, so
+\fBrand\fR should not be used to generate a sequence of secrets, such as
+one-time passwords. The seed of the generator is initialized from the
+internal clock of the machine or may be set with the \fBsrand\fR function.
.TP
\fBround(\fIarg\fB)\fR
If \fIarg\fR is an integer value, returns \fIarg\fR, otherwise converts
@@ -301,8 +304,8 @@ Returns the square root of \fIarg\fR. \fIArg\fR must be non-negative.
.TP
\fBsrand(\fIarg\fB)\fR
The \fIarg\fR, which must be an integer, is used to reset the seed for
-the random number generator. Returns the first random number from
-that seed. Each interpreter has its own seed.
+the random number generator of \fBrand\fR. Returns the first random
+number from that seed. Each interpreter has its own seed.
.TP
\fBtan(\fIarg\fB)\fR
Returns the tangent of \fIarg\fR, measured in radians.