MCPcopy Create free account
hub / github.com/breck7/scroll / randomPoisson

Function randomPoisson

external/.d3.js:14742–14755  ·  view source on GitHub ↗
(lambda)

Source from the content-addressed store, hash-verified

14740 B = binomial.source(source);
14741
14742 function randomPoisson(lambda) {
14743 return function() {
14744 var acc = 0, l = lambda;
14745 while (l > 16) {
14746 var n = Math.floor(0.875 * l),
14747 t = G(n)();
14748 if (t > l) return acc + B(n - 1, l / t)();
14749 acc += n;
14750 l -= t;
14751 }
14752 for (var s = -Math.log1p(-source()), k = 0; s <= l; ++k) s -= Math.log1p(-source());
14753 return acc + k;
14754 };
14755 }
14756
14757 randomPoisson.source = sourceRandomPoisson;
14758

Callers

nothing calls this directly

Calls 2

GFunction · 0.70
BFunction · 0.70

Tested by

no test coverage detected