12 #ifndef _H_SST_CORE_RNG_DISCRETE
13 #define _H_SST_CORE_RNG_DISCRETE
22 using namespace SST::RNG;
42 probCount(probsCount) {
44 probabilities = (
double*) malloc(
sizeof(
double) * probsCount);
47 for(uint32_t i = 0; i < probsCount; i++) {
48 probabilities[i] = prob_sum;
62 probCount(probsCount) {
64 probabilities = (
double*) malloc(
sizeof(
double) * probsCount);
67 for(uint32_t i = 0; i < probsCount; i++) {
68 probabilities[i] = prob_sum;
72 baseDistrib = baseDist;
73 deleteDistrib =
false;
92 const double nextD = baseDistrib->nextUniform();
96 for(; index < probCount; index++) {
97 if(probabilities[index] >= nextD) {
102 return (
double) index;
Base class of statistical distributions in SST.
Definition: distrib.h:24
~SSTDiscreteDistribution()
Destroys the exponential distribution.
Definition: discrete.h:79
bool deleteDistrib
Controls whether the base distribution should be deleted when this class is destructed.
Definition: discrete.h:114
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:91
double * probabilities
The discrete probability list.
Definition: discrete.h:119
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:124
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:61
Creates a discrete distribution for use within SST.
Definition: discrete.h:33
SSTDiscreteDistribution(const double *probs, const uint32_t probsCount)
Creates an exponential distribution with a specific lambda.
Definition: discrete.h:40
SSTRandom * baseDistrib
Sets the base random number generator for the distribution.
Definition: discrete.h:109