Class rng

Inheritance Relationships

Base Type

Class Documentation

class rng : public rcppsw::patterns::pimpl::pimpl<detail::rng_impl>

Random number generator class using the PIMPL pattern in order to not have to include <random>.

Public Functions

explicit rng(size_t seed)
~rng(void) override
bool bernoulli(double p)

Return a selection according to a Bernoulli distribution with parameter p.

double exponential(double lambda)

Return a selection according to the exponential distribution \(1 - e ^(-lambda)\).

double gaussian(double mean, double std_dev)

Return a selection according to the Gaussian distribution \(G(\mu, \sigma)\).

inline size_t seed(void) const

Get the current seed.

template<typename T>
inline T uniform(const range<T> &c_range)

Return a uniform selection in the range specified by c_range.

template<typename T>
T uniform(const T &lb, const T &ub)

Return a uniform selection in the range [lb, ub].