next up previous contents index
Next: Generating Systematic Data Up: More on Generating Previous: More on Generating

Generating Random Data

XLISP-STAT has several functions for generating pseudo-random numbers. For example, the expression

(uniform-rand 50)
will generate a list of 50 independent uniform random variables. The functions normal-rand and cauchy-rand work similarly. Other generating functions require additional arguments to specify distribution parameters. Here is a list of the functions available for dealing with probability distributions:

More information on the required arguments is given in the appendix in Section gif. The discrete quantile functions binomial-quant and poisson-quant return values of a left continuous inverse of the cdf. The pmf's for these distributions are only defined for integer arguments. The quantile functions and random variable generators for the beta, gamma, , t and F distributions are presently calculated by inverting the cdf and may be a bit slow.

The state of the internal random number generator can be ``randomly'' reseeded, and the current value of the generator state can be saved. The mechanism used is the standard Common Lisp mechanism. The current random state is held in the variable *random-state*. The function make-random-state can be used to set and save the state. It takes an optional argument. If the argument is NIL or omitted make-random-state returns a copy of the current value of *random-state*. If the argument is a state object a copy of it is returned. If the argument is t a new, ``randomly'' initialized state object is produced and returned. gif

Luke Tierney
Tue Jan 21 15:04:48 CST 1997