38 cPoint(
int a_Value,
int a_Probability) :
Class to wrap any random engine to provide a more convenient interface.
void SetPoints(const cPoints &a_Points)
Sets the distribution curve using an array of [value, probability] points, linearly interpolated.
cPoints m_Cumulative
Cumulative probability of the values, sorted, for fast bsearch lookup.
cProbabDistrib(int a_MaxValue)
bool SetDefString(const AString &a_DefString)
Sets the distribution curve using a definition string; returns true on successful parse.
int Random(MTRand &a_Rand) const
Gets a random value from a_Rand, shapes it into the distribution curve and returns the value.
std::vector< cPoint > cPoints
int m_Sum
Sum of all the probabilities across all values in the domain; -1 if not set.
int MapValue(int a_OrigValue) const
Maps value in range [0, m_Sum] into the range [0, m_MaxValue] using the stored probability.
cPoint(int a_Value, int a_Probability)