Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

Random functions
[Miscellaneous helper algorithms]


Classes

class  spot::barand< gen >
 Compute pseudo-random integer value between 0 and n included, following a binomial distribution for probability p. More...

Functions

void spot::srand (unsigned int seed)
 Reset the seed of the pseudo-random number generator.
int spot::rrand (int min, int max)
 Compute a pseudo-random integer value between min and max included.
int spot::mrand (int max)
 Compute a pseudo-random integer value between 0 and max-1 included.
double spot::drand ()
 Compute a pseudo-random double value between 0.0 and 1.0 (1.0 excluded).
double spot::nrand ()
 Compute a pseudo-random double value following a standard normal distribution. (Odeh & Evans).
double spot::bmrand ()
 Compute a pseudo-random double value following a standard normal distribution. (Box-Muller).
int spot::prand (double p)
 Return a pseudo-random positive integer value following a Poisson distribution with parameter p.

Function Documentation

double bmrand  ) 
 

Compute a pseudo-random double value following a standard normal distribution. (Box-Muller).

This uses the polar form of the Box-Muller transform to generate random values.

double drand  ) 
 

Compute a pseudo-random double value between 0.0 and 1.0 (1.0 excluded).

See also:
mrand, rrand, srand

int mrand int  max  ) 
 

Compute a pseudo-random integer value between 0 and max-1 included.

See also:
drand, rrand, srand

double nrand  ) 
 

Compute a pseudo-random double value following a standard normal distribution. (Odeh & Evans).

This uses a polynomial approximation of the inverse cumulated density function from Odeh & Evans, Journal of Applied Statistics, 1974, vol 23, pp 96-97.

int prand double  p  ) 
 

Return a pseudo-random positive integer value following a Poisson distribution with parameter p.

Precondition:
p > 0

int rrand int  min,
int  max
 

Compute a pseudo-random integer value between min and max included.

See also:
drand, mrand, srand

void srand unsigned int  seed  ) 
 

Reset the seed of the pseudo-random number generator.

See also:
drand, mrand, rrand


Please comment this page and report errors about it on the RefDocComments page.
Generated on Mon Jan 31 12:55:19 2005 for spot by doxygen 1.4.0