12 #ifndef _H_SST_CORE_RNG_DISCRETE
13 #define _H_SST_CORE_RNG_DISCRETE
40 probCount(probsCount) {
42 probabilities = (
double*) malloc(
sizeof(
double) * probsCount);
45 for(uint32_t i = 0; i < probsCount; i++) {
46 probabilities[i] = prob_sum;
60 probCount(probsCount) {
62 probabilities = (
double*) malloc(
sizeof(
double) * probsCount);
65 for(uint32_t i = 0; i < probsCount; i++) {
66 probabilities[i] = prob_sum;
70 baseDistrib = baseDist;
71 deleteDistrib =
false;
90 const double nextD = baseDistrib->nextUniform();
94 for(; index < probCount; index++) {
95 if(probabilities[index] >= nextD) {
100 return (
double) index;
Definition: constant.h:22
Base class of statistical distributions in SST.
Definition: distrib.h:24
~SSTDiscreteDistribution()
Destroys the exponential distribution.
Definition: discrete.h:77
bool deleteDistrib
Controls whether the base distribution should be deleted when this class is destructed.
Definition: discrete.h:112
Implements a Mersenne-based RNG for use in the SST core or components.
Definition: mersenne.h:34
double getNextDouble()
Gets the next (random) double value in the distribution.
Definition: discrete.h:89
double * probabilities
The discrete probability list.
Definition: discrete.h:117
Implements the base class for random number generators for the SST core.
Definition: sstrng.h:27
uint32_t probCount
Count of discrete probabilities.
Definition: discrete.h:122
SSTDiscreteDistribution(const double *probs, const uint32_t probsCount, SSTRandom *baseDist)
Creates an exponential distribution with a specific lambda and a base random number generator...
Definition: discrete.h:59
Creates a discrete distribution for use within SST.
Definition: discrete.h:31
SSTDiscreteDistribution(const double *probs, const uint32_t probsCount)
Creates an exponential distribution with a specific lambda.
Definition: discrete.h:38
SSTRandom * baseDistrib
Sets the base random number generator for the distribution.
Definition: discrete.h:107