diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2019-02-01 10:10:51 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2019-02-01 10:10:51 +0200 |
commit | 025a7fcf510c2bd8dde185cc65b5e12b8d506375 (patch) | |
tree | f3753e5d5e77c057317e91e411b95c4c8f31a5ae /doc/gawktexi.in | |
parent | 67ba4ceb06ca36e888c7e7a542244e00ec62a11e (diff) | |
download | egawk-025a7fcf510c2bd8dde185cc65b5e12b8d506375.tar.gz egawk-025a7fcf510c2bd8dde185cc65b5e12b8d506375.tar.bz2 egawk-025a7fcf510c2bd8dde185cc65b5e12b8d506375.zip |
Doc updates.
Diffstat (limited to 'doc/gawktexi.in')
-rw-r--r-- | doc/gawktexi.in | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/doc/gawktexi.in b/doc/gawktexi.in index b353c14e..bd8471b5 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -17200,18 +17200,23 @@ otherwise, return @code{NaN} (``not a number'') on IEEE 754 systems. Additionally, @command{gawk} prints a warning message when @code{x} is negative. +@cindex Beebe, Nelson H.F.@: @item @code{rand()} @cindexawkfunc{rand} @cindex random numbers, @code{rand()}/@code{srand()} functions Return a random number. The values of @code{rand()} are uniformly distributed between zero and one. -The value could be zero but is never one.@footnote{The C version of @code{rand()} -on many Unix systems -is known to produce fairly poor sequences of random numbers. -However, nothing requires that an @command{awk} implementation use the C -@code{rand()} to implement the @command{awk} version of @code{rand()}. -In fact, @command{gawk} uses the BSD @code{random()} function, which is -considerably better than @code{rand()}, to produce random numbers.} +The value could be zero but is never one.@footnote{The C version of +@code{rand()} on many Unix systems is known to produce fairly poor +sequences of random numbers. However, nothing requires that an +@command{awk} implementation use the C @code{rand()} to implement the +@command{awk} version of @code{rand()}. In fact, for many years, +@command{gawk} used the BSD @code{random()} function, which is +considerably better than @code{rand()}, to produce random numbers. +From @value{PVERSION} 4.1.4, courtesy of Nelson H.F.@: Beebe, @command{gawk} +uses the Bayes-Durham shuffle buffer algorithm which considerably extends +the period the random number generator, and eliminates short-range and +long-range correlations that might exist in the original generator.} Often random integers are needed instead. Following is a user-defined function that can be used to obtain a random nonnegative integer less than @var{n}: |