Random numbers
Class: Random_number_generator
This is a polymorphic base class for any of the continuous generators
described below.
Data for an object of this class is
name_of_subclass (listed below for each continuous class)
data_for_class (if necessary)
Class: Ransub
Generates random numbers with uniform probability over the range [0,1),
using Knuth's subtractive algorithm.
Type name: unit_uniform
.
Data: none.
Class: Ranuniform
Generates random numbers with a uniform distribution.
Type name: uniform
Data format:
double vmin, vmax; // limits of range
Class: Ranlorentz
Generates random numbers with a Lorentzian distribution.
Type name: lorentzian
Data format:
double r; // width of distribution
double xc; // centre of distribution
Class: Rangauss
Generates random numbers with a Gaussian distribution of unit width,
centred on the origin.
Type name: unit_gaussian
.
(No parameters.)
Class: Rangaussgen
Generates random numbers with a Gaussian distribution.
Type name: gaussian
.
Data format:
double r; // width of distribution
double xc; // centre of distribution
Class: Ranexp
Generates random numbers with an exponential distribution.
Type name: exponential
.
Data format:
double r; // width of distribution
double xc; // centre of distribution
Class: Randisexp
Generates random numbers with an exponential distribution of unit width,
in the positive arm of the distribution.
Type name: unit_positive_exponential
.
(No parameters.)
Class: Ranset
Generates discrete random outcomes (integers) with a distribution
defined by a set of probabilities.
Data format:
number_of_possible_outcomes
For each:
probability
The probabilities should add up to 1 or less.
The index of the outcomes runs from 0 to N-1.
If the total probability adds up to less than 1, then
the result `none of the above' is given as -1.