diff options
author | Julian Laubstein <julianlaubstein@yahoo.de> | 2016-02-06 11:37:34 +0100 |
---|---|---|
committer | Julian Laubstein <julianlaubstein@yahoo.de> | 2016-02-06 11:37:34 +0100 |
commit | 6fdd7194c81be7234a126bdc3b48f0291fce3567 (patch) | |
tree | 7d5ac74b7385ce4ebf77588d80549c884c2b993c /src/ProbabDistrib.cpp | |
parent | Merge pull request #2958 from LogicParrot/fence (diff) | |
parent | Bulk clearing of whitespace (diff) | |
download | cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.gz cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.bz2 cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.lz cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.xz cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.zst cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.zip |
Diffstat (limited to '')
-rw-r--r-- | src/ProbabDistrib.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ProbabDistrib.cpp b/src/ProbabDistrib.cpp index ec3a4d85f..f63aa0605 100644 --- a/src/ProbabDistrib.cpp +++ b/src/ProbabDistrib.cpp @@ -43,7 +43,7 @@ void cProbabDistrib::SetPoints(const cProbabDistrib::cPoints & a_Points) { continue; } - + // Add the current trapezoid to the sum: ProbSum += (LastProb + itr->m_Probability) * (itr->m_Value - LastValue) / 2; LastProb = itr->m_Probability; @@ -89,7 +89,7 @@ bool cProbabDistrib::SetDefString(const AString & a_DefString) } Pts.push_back(cPoint(Value, Prob)); } // for itr - Points[] - + SetPoints(Pts); return true; } @@ -112,7 +112,7 @@ int cProbabDistrib::MapValue(int a_OrigValue) const { ASSERT(a_OrigValue >= 0); ASSERT(a_OrigValue < m_Sum); - + // Binary search through m_Cumulative for placement: size_t Lo = 0; size_t Hi = m_Cumulative.size() - 1; @@ -130,7 +130,7 @@ int cProbabDistrib::MapValue(int a_OrigValue) const } } ASSERT(Hi - Lo == 1); - + // Linearly interpolate between Lo and Hi: int ProbDif = m_Cumulative[Hi].m_Probability - m_Cumulative[Lo].m_Probability; ProbDif = (ProbDif != 0) ? ProbDif : 1; |