diff --git a/doc/ref/scheme-data.texi b/doc/ref/scheme-data.texi index f45170773..a05a07e62 100755 --- a/doc/ref/scheme-data.texi +++ b/doc/ref/scheme-data.texi @@ -1229,6 +1229,11 @@ through @var{end} (exclusive) bits of @var{n}. The @node Random @subsection Random Number Generation +Pseudo-random numbers are generated from a random state object, which +can be created with @code{seed->random-state}. The @var{state} +parameter to the various functions below is optional, it defaults to +the state object in the @code{*random-state*} variable. + @deffn {Scheme Procedure} copy-random-state [state] @deffnx {C Function} scm_copy_random_state (state) Return a copy of the random state @var{state}. @@ -1242,12 +1247,6 @@ Accepts a positive integer or real n and returns a number of the same type between zero (inclusive) and @var{n} (exclusive). The values returned have a uniform distribution. - -The optional argument @var{state} must be of the type produced -by @code{seed->random-state}. It defaults to the value of the -variable @code{*random-state*}. This object is used to maintain -the state of the pseudo-random-number generator and is altered -as a side effect of the random operation. @end deffn @deffn {Scheme Procedure} random:exp [state] @@ -1302,6 +1301,11 @@ Return a uniformly distributed inexact real random number in Return a new random state using @var{seed}. @end deffn +@defvar *random-state* +The global random state used by the above functions when the +@var{state} parameter is not given. +@end defvar + @node Characters @section Characters