10.10 srfi-27 - Sources of Random Bits
- Module: srfi-27
-
This module provides SRFI-27 pseudo random generator interface,
using Mersenne Twister algorithm
(See section 11.8
math.mt-random - Mersenne Twister Random number generator) as the backbone.
- Function: random-integer n
- [SRFI-27]
Returns a random exact integer between [0, n-1], inclusive,
using the default random source.
To set a random seed for this procedure, use
random-source-randomize!
or random-source-pseudo-randomize! on default-random-source.
- Function: random-real
- [SRFI-27]
Returns a random real number between (0, 1), exclusive,
using the default random source.
To set a random seed for this procedure, use
random-source-randomize!
or random-source-pseudo-randomize! on default-random-source.
- Variable: default-random-source
- [SRFI-27]
Keeps the default random source that is used by
random-integer
and random-real.
- Function: make-random-source
- [SRFI-27]
Creates and returns a new random source.
In the current Gauche implementation, it is just a
<mersenne-twister>
object. It may be changed in the future implementation.
- Function: random-source? obj
- [SRFI-27]
Returns
#t if obj is a random source object.
- Function: random-source-state-ref s
-
- Function: random-source-state-set! s state
- [SRFI-27]
Gets and sets the "snapshot" of the state of the random source s.
State is an opaque object whose content depends on the backbone
generator.
- Function: random-source-randomize! s
- [SRFI-27]
Makes an effort to set the state of the random source s to
a truly random state. The current implementation uses the current
time and the process ID to set the random seed.
- Function: random-source-pseudo-randomize! s i j
- [SRFI-27]
Changes the state of the random source s into the initial state
of the (i, j)-th independent random source,
where i and j are non-negative integers.
This procedure can be used to reuse a random source s as large
number of independent random source, indexed by two non-negative integers.
Note that this procedure is entirely deterministic.
- Function: random-source-make-integers s
- [SRFI-27]
Returns a procedure, that takes one integer argument n and
returns a random integer between 0 and n-1 inclusive for every
invocation, from the random source s.
- Function: random-source-make-reals s &optional unit
- [SRFI-27]
Returns a procedure, that takes no argument and
returns a random real between 0 and 1 exclusive for
every invocation, from the random source s.
If unit is given, the random real the returned procedure
generates will be quantized by the given unit, where
0 < unit < 1.
This document was generated
by Ken Dickey on November, 28 2002
using texi2html