From ad4d7a59adfcba939a63d9fc699ea4754c39f2e5 Mon Sep 17 00:00:00 2001 From: ericzhang Date: Wed, 15 May 2013 18:06:48 +0800 Subject: [PATCH] bug fix --- src/random.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/random.js b/src/random.js index 5fe42e3..8d30db0 100644 --- a/src/random.js +++ b/src/random.js @@ -29,13 +29,12 @@ exports.beta = function (v, w, min, max) { if (v < w) { - return max - (max - min) * _this.beta(w, v); + return max - (max - min) * _this.beta(w, v, min, max); } var y1 = _this.gamma(0, 1, v), - y1 = _this.gamma(0, 1, w); + y2 = _this.gamma(0, 1, w); return min + (max - min) * y1 / (y1 + y2); - }; exports.cauchy = function (a, b) { @@ -85,7 +84,7 @@ return (_this.chiSquare(v) / v) / (_this.chiSquare(w) / w); }; - exports.gamma(a, b, c) { + exports.gamma = function (a, b, c) { var A = 1 / sqrt(2 * c - 1), B = c - log(4), Q = c + 1 / A, @@ -216,7 +215,7 @@ return min + (max - min) * random(); }; - exports.userSpecified(usf, xMin, xMax, yMin, yMax) { + exports.userSpecified = function (usf, xMin, xMax, yMin, yMax) { var x, y, areaMax = (xMax - xMin) * (yMax - yMin);