12 #ifndef SST_CORE_RNG_GAUSSIAN_H 13 #define SST_CORE_RNG_GAUSSIAN_H 88 double gauss_u, gauss_v, sq_sum;
93 sq_sum = (gauss_u * gauss_u) + (gauss_v * gauss_v);
94 }
while ( sq_sum >= 1 || sq_sum == 0 );
104 double multiplier = sqrt(-2.0 * log(sq_sum) / sq_sum);
108 return mean +
stddev * gauss_u * multiplier;
182 #endif // SST_CORE_RNG_GAUSSIAN_H Implements the base class for random number generators for the SST core.
Definition: rng.h:29
GaussianDistribution(double mn, double sd, Random *baseRNG)
Creates a new distribution with a predefined random number generator with a specified mean and standa...
Definition: gaussian.h:54
Definition: constant.h:18
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:42
bool usePair
Random numbers for the distribution are read in pairs, this tells the code to use the second of the p...
Definition: gaussian.h:169
bool deleteDistrib
Controls whether the destructor deletes the distribution (we need to ensure we do this IF we created ...
Definition: gaussian.h:175
ImplementSerializable(SST::RNG::GaussianDistribution) protected double stddev
Serialization macro.
Definition: gaussian.h:147
Implements a Mersenne-based RNG for use in the SST core or components.
Definition: mersenne.h:34
Random * baseDistrib
The base random number generator for the distribution.
Definition: gaussian.h:161
~GaussianDistribution()
Destroys the Gaussian distribution.
Definition: gaussian.h:70
void serialize_order(SST::Core::Serialization::serializer &ser) override
Serialization function for checkpoint.
Definition: gaussian.h:134
double getNextDouble() override
Gets the next double value in the distribution.
Definition: gaussian.h:81
GaussianDistribution()
Default constructor.
Definition: gaussian.h:127
Creates a Gaussian (normal) distribution for which to sample.
Definition: gaussian.h:27
double getMean()
Gets the mean of the distribution.
Definition: gaussian.h:116
double getStandardDev()
Gets the standard deviation of the distribution.
Definition: gaussian.h:122
double unusedPair
Random numbers for the distribution are read in pairs, this stores the second of the pair...
Definition: gaussian.h:165
Base class of statistical distributions in SST.
Definition: distrib.h:23
virtual double nextUniform()=0
Generates the next random number in the range [0,1).
GaussianDistribution(double mn, double sd)
Creates a new distribution with a predefined random number generator with a specified mean and standa...
Definition: gaussian.h:36