Public
Edited
Jul 24, 2020
Insert cell
Insert cell
Insert cell
pachinko(randomNegativeBinomial(r0, p0))
Insert cell
Insert cell
Insert cell
function randomNegativeBinomial(r, p) {
var g = d3r.randomGamma(r, (1 - p) / p);
return function() {
return d3r.randomPoisson(g())();
}
}
Insert cell
Insert cell
Insert cell
pachinko(randomSkellam(lambda1, lambda2))
Insert cell
Insert cell
Insert cell
function randomSkellam(l1, l2) {
var L1 = d3r.randomPoisson(l1),
L2 = d3r.randomPoisson(l2);
return function() {
return L1() - L2();
}
}
Insert cell
Insert cell
pachinko(randomLogarithmicSeries(p1), [1, 100])
Insert cell
Insert cell
function randomLogarithmicSeries(p) {
p = 1 - p;
return function() {
return Math.ceil(Math.log1p(-Math.random()) / Math.log1p(-(p ** (1 - Math.random()))));
}
}
Insert cell
Insert cell
pachinko(randomZeta(a0), [1, 20])
Insert cell
Insert cell
function randomZeta(a) {
var c = Math.expm1(-a * Math.LN2),
r = 1 / -a;
return function() {
do {
var x = Math.floor(Math.random() ** r),
t = Math.expm1(-a * Math.log1p(1 / x));
} while (Math.random() * x * t < c);
return x;
}
}
Insert cell
Insert cell
pachinko(randomYuleSimon(rho0), [1, 100])
Insert cell
Insert cell
function randomYuleSimon(rho) {
rho = 1 / rho;
return function() {
return d3r.randomGeometric(1 - Math.random() ** rho)();
}
}
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more