![]() |
Plasma Engine
2.0
|
A random number generator that produces values with a normal / Gaussian distribution. More...
#include <Random.h>
Public Member Functions | |
void | Initialize (plUInt64 uiRandomSeed, plUInt32 uiMaxValue, float fVariance=1.0f) |
Initializes the RNG and sets the maximum value that the functions UnsignedValue() and SignedValue() may return. | |
plUInt32 | UnsignedValue () |
Returns a value in range [0; uiMaxValue - 1] with a Gaussian distribution. Ie. 0 is much more probable than uiMaxValue. | |
plInt32 | SignedValue () |
Returns a value in range [-uiMaxValue + 1; uiMaxValue - 1] with a Gaussian distribution. Ie. 0 is much more probable than +/-uiMaxValue. | |
void | Save (plStreamWriter &inout_stream) const |
Serializes the current state. | |
void | Load (plStreamReader &inout_stream) |
Deserializes the current state. | |
A random number generator that produces values with a normal / Gaussian distribution.
void plRandomGauss::Initialize | ( | plUInt64 | uiRandomSeed, |
plUInt32 | uiMaxValue, | ||
float | fVariance = 1.0f ) |
Initializes the RNG and sets the maximum value that the functions UnsignedValue() and SignedValue() may return.
The Variance configures the distribution of the samples. 1.0 gives a standard bell-curve. Values below 1 lead to a distribution with more emphasis around zero, whereas values above 1 result in a flatter curve with more equally distributed results.
For more details, look here: https://en.wikipedia.org/wiki/Normal_distribution