53 assert(rand >= 0.0 && rand <= 1.0);
60 assert(upper >= lower);
61 ii = (upper + lower) / 2;
62 if (
m_cmf[ii] >= rand) {
63 if (ii == 0 ||
m_cmf[ii - 1] <= rand)
85 uint64_t temp_num, index;
90 index = std::uniform_int_distribution<uint64_t>(0, m_value_count-1)(
m_random_engine);
108 for (ii = 0; ii < m_value_count + 1 ;++ii) {
109 m_cmf[ii] /= norm_const;
uint64_t m_pool_min
Lower bound of the range.
uint64_t * m_numbers
Array with the random samples.
Discrete Random Generator.
uint64_t m_pool_max
Upper bound of the range.
std::mt19937 m_random_engine
The random number generator.
uint64_t m_value_count
Number of values in the range.
Logging routines and macros.
Compatibility Macros for C/C++.
virtual double pmf(uint64_t val)
Returns the probability of drawing a specific value from the distribution.
virtual uint64_t get_sample()
Returns a random sample from the distribution.
virtual void generate_cmf()
Generate the cumulative mass function for the distribution.
double * m_cmf
The cumulative mass of the distribution.