manpagez: man pages & more
info guile
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.19.2 Random Sources

Function: make-random-source

Create a new random source. The stream of random numbers obtained from each random source created by this procedure will be identical, unless its state is changed by one of the procedures below.

Function: random-source? object

Tests whether object is a random source. Random sources are a disjoint type.

Function: random-source-randomize! source

Attempt to set the state of the random source to a truly random value. The current implementation uses a seed based on the current system time.

Function: random-source-pseudo-randomize! source i j

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 provides a mechanism to obtain a large number of independent random sources (usually all derived from the same backbone generator), indexed by two integers. In contrast to random-source-randomize!, this procedure is entirely deterministic.

The state associated with a random state can be obtained an reinstated with the following procedures:

Function: random-source-state-ref source
Function: random-source-state-set! source state

Get and set the state of a random source. No assumptions should be made about the nature of the state object, besides it having an external representation (i.e. it can be passed to write and subsequently read back).


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on April 20, 2013 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.