## Random Library

#
**The ****Random Library**

**Designed by the Gwydion Project**
The Random library provides random number support in several random number distributions. The Random module of the Random library exports the following names:

**random** [Function]

*(upper-bound :: <integer>, #key state) => uniform-random-number :: <integer>;*

Provides a random non-negative integer less than *upper-bound*. The distribution of the random numbers returned is uniform. The *state* argument is described below.

**random-bits** [Function]

*(#key state) => uniform-random-number :: <fixed-integer>;*

Returns a fixed integer that has **$random-bits-count** random bits. This function is the fastest way to get a random series of bits. The *state* argument is described below.

$**random-bits-count** [Constant]

The number of random bits that the **random-bits** function returns.

**random-float** [Function]

*(upper-bound :: <number>, #key state) => uniform-random-number :: <float>;*

Returns a random non-negative float less than *upper-bound*. The distribution of the random numbers returned is uniform. The *state* argument is described below.

**random-gaussian** [Function]

*(#key mean = 0, standard-deviation = 1, state)*

Returns a random float. The distribution of the random numbers returned is Gaussian (also known as "normal"), with a mean of *mean* and a standard deviation of *standard-deviation*. The *state* argument is described below.

**random-exponential** [Function]

*(#key lambda = 1, state)*

Returns a random non-negative float. The distribution of the random numbers returned is exponential, with a lambda of *lambda*. The *state* argument is described below.

**<random-state>** [Sealed Class]

**<random-state>** is the class of objects which serve as states for the random number generators. Make() of **<random-state>** accepts the *seed* keyword, which is an integer used as a seed value for the random-state. If *seed* is not provided, a seed based on the current time of day will be used. **<random-state>**s are not threadsafe; see below.

All of the random functions optionally take a **state:** keyword, which specifies the **<random-state>** to use. If a state is not specified, a default state will be used. In a multi-threaded environment, using the default state is guaranteed to be threadsafe. Implementations may use a unique default state object per thread, or a single default state object shared by all threads but accessed in a safe way. Random-states other than the default state objects are not threadsafe.

Copyright 1994, 1995, 1996, 1997 Carnegie Mellon University. All rights reserved.
Send comments and bug reports to gwydion-bugs@cs.cmu.edu