summaryrefslogtreecommitdiffstats
path: root/src/ProbabDistrib.h
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-02-05 22:45:45 +0100
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-02-05 22:50:18 +0100
commitca6ef58b1ee8521e4b940ee4883dee714960e413 (patch)
tree8532add455224b07c07a759e3d906f50c0695888 /src/ProbabDistrib.h
parentMerge pull request #2972 from marvinkopf/PlayerAutoComplete (diff)
downloadcuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.gz
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.bz2
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.lz
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.xz
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.zst
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.zip
Diffstat (limited to '')
-rw-r--r--src/ProbabDistrib.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/ProbabDistrib.h b/src/ProbabDistrib.h
index 29442bce8..aeac5a30a 100644
--- a/src/ProbabDistrib.h
+++ b/src/ProbabDistrib.h
@@ -35,33 +35,33 @@ public:
public:
int m_Value;
int m_Probability;
-
+
cPoint(int a_Value, int a_Probability) :
m_Value(a_Value),
m_Probability(a_Probability)
{
}
} ;
-
+
typedef std::vector<cPoint> cPoints;
-
-
+
+
cProbabDistrib(int a_MaxValue);
-
+
/** Sets the distribution curve using an array of [value, probability] points, linearly interpolated. a_Points must not be empty. */
void SetPoints(const cPoints & a_Points);
-
+
/** Sets the distribution curve using a definition string; returns true on successful parse */
bool SetDefString(const AString & a_DefString);
-
+
/** Gets a random value from a_Rand, shapes it into the distribution curve and returns the value. */
int Random(MTRand & a_Rand) const;
-
+
/** Maps value in range [0, m_Sum] into the range [0, m_MaxValue] using the stored probability */
int MapValue(int a_OrigValue) const;
-
+
int GetSum(void) const { return m_Sum; }
-
+
protected:
int m_MaxValue;