spot 2.2.2

- Main Page
- Related Pages
- Modules
- Classes
- Files

All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Random functions
Miscellaneous helper functions

void | spot::srand (unsigned int seed)
| Reset the seed of the pseudo-random number generator. More...
int | spot::rrand (int min, int max)
| Compute a pseudo-random integer value between min and max included. More...
int | spot::mrand (int max)
| Compute a pseudo-random integer value between 0 and max-1 included. More...
double | spot::drand ()
| Compute a pseudo-random double value between 0.0 and 1.0 (1.0 excluded). More...
double | spot::nrand ()
| Compute a pseudo-random double value following a standard normal distribution. (Odeh & Evans) More...
double | spot::bmrand ()
| Compute a pseudo-random double value following a standard normal distribution. (Box-Muller) More...
int | spot::prand (double p)
| Return a pseudo-random positive integer value following a Poisson distribution with parameter p. More...
template<class iterator_type >
void | spot::mrandom_shuffle (iterator_type &&first, iterator_type &&last)
| Shuffle the container using mrand function above. This allows to get rid off shuffle or random_shuffle that use uniform_distribution and RandomIterator that are not portables. More...

## Detailed Description

## Function Documentation

double spot::bmrand | ( |  | ) |

`#include <spot/misc/random.hh>`

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 spot::drand | ( |  | ) |

`#include <spot/misc/random.hh>`

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

See also
  mrand, rrand, srand

int spot::mrand | ( | int | max | ) |

`#include <spot/misc/random.hh>`

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

See also
  drand, rrand, srand

Referenced by spot::mrandom_shuffle().

template<class iterator_type >

void spot::mrandom_shuffle | ( | iterator_type && | first,
|  | iterator_type && | last
| ) |  |

`#include <spot/misc/random.hh>`

Shuffle the container using mrand function above. This allows to get rid off shuffle or random_shuffle that use uniform_distribution and RandomIterator that are not portables.

References spot::mrand().

double spot::nrand | ( |  | ) |

`#include <spot/misc/random.hh>`

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 spot::prand | ( | double | p | ) |

`#include <spot/misc/random.hh>`

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

Precondition
  `p > 0`

int spot::rrand | ( | int | min,
|  | int | max
| ) |  |

`#include <spot/misc/random.hh>`

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

See also
  drand, mrand, srand

void spot::srand | ( | unsigned int | seed | ) |

`#include <spot/misc/random.hh>`

Reset the seed of the pseudo-random number generator.

See also
  drand, mrand, rrand

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.