#include <yat/random/random.h>
Public Member Functions | |
DiscreteGeneral (const statistics::Histogram &hist) | |
Constructor. | |
DiscreteGeneral (const DiscreteGeneral &) | |
Copy constructor. | |
~DiscreteGeneral (void) | |
Destructor. | |
unsigned long | operator() (void) const |
DiscreteGeneral & | operator= (const DiscreteGeneral &) |
Assignment operator. | |
void | seed (unsigned long s) const |
Set the seed to s. | |
unsigned long | seed_from_devurandom (void) |
Set the seed using the /dev/urandom device. | |
Protected Attributes | |
RNG * | rng_ |
GSL random gererator. |
theplu::yat::random::DiscreteGeneral::DiscreteGeneral | ( | const statistics::Histogram & | hist | ) |
Constructor.
hist | is a Histogram defining the probability distribution |
theplu::yat::random::DiscreteGeneral::DiscreteGeneral | ( | const DiscreteGeneral & | ) |
unsigned long theplu::yat::random::DiscreteGeneral::operator() | ( | void | ) | const [virtual] |
The generated number is an integer and proportinal to the frequency in the corresponding histogram bin. In other words, the probability that 0 is returned is proportinal to the size of the first bin.
Implements theplu::yat::random::Discrete.
DiscreteGeneral& theplu::yat::random::DiscreteGeneral::operator= | ( | const DiscreteGeneral & | ) |
void theplu::yat::random::Discrete::seed | ( | unsigned long | s | ) | const [inherited] |
Set the seed to s.
Set the seed to s in the underlying rng. If s is zero, a default value from the rng's original implementation is used (cf. GSL documentation).
unsigned long theplu::yat::random::Discrete::seed_from_devurandom | ( | void | ) | [inherited] |
Set the seed using the /dev/urandom device.