site/node_modules/d3-random/src/beta.js

20 lines
424 B
JavaScript
Raw Normal View History

2024-10-14 06:09:33 +00:00
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);