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 "2D normal-rand and "2D 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:
normal-cdf normal-quant normal-rand normal-dens
cauchy-cdf cauchy-quant cauchy-rand cauchy-dens
beta-cdf beta-quant beta-rand beta-dens
gamma-cdf gamma-quant gamma-rand gamma-dens
chisq-cdf chisq-quant chisq-rand chisq-dens
t-cdf t-quant t-rand t-dens
f-cdf f-quant f-rand f-dens
       
binomial-cdf binomial-quant binomial-rand binomial-pmf
poisson-cdf poisson-quant poisson-rand poisson-pmf
More information on the required arguments is given in the appendix in Section [*]. 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, χ2, 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 "2D *random-state*. The function "2D make-random-state can be used to set and save the state. It takes an optional argument. If the argument is NIL or omitted "2D make-random-state returns a copy of the current value of "2D *random-state*. If the argument is a state object a copy of it is returned. If the argument is "2D t a new, ``randomly'' initialized state object is produced and returned. 6