12 #ifndef SST_CORE_RNG_DISCRETE_H
13 #define SST_CORE_RNG_DISCRETE_H
22 using namespace SST::RNG;
47 probabilities = (
double*)malloc(
sizeof(
double) * probsCount);
50 for ( uint32_t i = 0; i < probsCount; i++ ) {
51 probabilities[i] = prob_sum;
68 probabilities = (
double*)malloc(
sizeof(
double) * probsCount);
71 for ( uint32_t i = 0; i < probsCount; i++ ) {
72 probabilities[i] = prob_sum;
76 baseDistrib = baseDist;
77 deleteDistrib =
false;
87 if ( deleteDistrib ) {
delete baseDistrib; }
97 const double nextD = baseDistrib->nextUniform();
101 for ( ; index < probCount; index++ ) {
102 if ( probabilities[index] >= nextD ) {
break; }
105 return (
double)index;
Creates a discrete distribution for use within SST.
Definition: discrete.h:34
~DiscreteDistribution()
Destroys the exponential distribution.
Definition: discrete.h:83
uint32_t probCount
Count of discrete probabilities.
Definition: discrete.h:127
DiscreteDistribution(const double *probs, const uint32_t probsCount, SST::RNG::Random *baseDist)
Creates an exponential distribution with a specific lambda and a base random number generator.
Definition: discrete.h:64
bool deleteDistrib
Controls whether the base distribution should be deleted when this class is destructed.
Definition: discrete.h:117
double getNextDouble()
Gets the next (random) double value in the distribution.
Definition: discrete.h:95
double * probabilities
The discrete probability list.
Definition: discrete.h:122
SST::RNG::Random * baseDistrib
Sets the base random number generator for the distribution.
Definition: discrete.h:112
DiscreteDistribution(const double *probs, const uint32_t probsCount)
Creates a discrete probability distribution.
Definition: discrete.h:42
Implements a Mersenne-based RNG for use in the SST core or components.
Definition: mersenne.h:35
Base class of statistical distributions in SST.
Definition: distrib.h:23
Implements the base class for random number generators for the SST core.
Definition: rng.h:28