site/node_modules/d3-random/src/beta.js
2024-10-14 08:09:33 +02:00

20 lines
424 B
JavaScript

import defaultSource from "./defaultSource.js";
import gamma from "./gamma.js";
export default (function sourceRandomBeta(source) {
var G = gamma.source(source);
function randomBeta(alpha, beta) {
var X = G(alpha),
Y = G(beta);
return function() {
var x = X();
return x === 0 ? 0 : x / (x + Y());
};
}
randomBeta.source = sourceRandomBeta;
return randomBeta;
})(defaultSource);