Changed branching, such that the code complies with the definition

referred to in the doc. [Spotted by D. Hendriks.]


git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1292741 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gilles Sadowski 2012-02-23 11:26:36 +00:00
parent 15a28dad20
commit f9a9cde5fb
1 changed files with 1 additions and 1 deletions

View File

@ -260,7 +260,7 @@ public class TriangularDistribution extends AbstractRealDistribution {
if (p == 1) {
return b;
}
if (p <= (c - a) / (b - a)) {
if (p < (c - a) / (b - a)) {
return a + FastMath.sqrt(p * (b - a) * (c - a));
}
return b - FastMath.sqrt((1 - p) * (b - a) * (b - c));