config redirect

This commit is contained in:
Nuno Coração
2023-01-29 22:30:24 +00:00
parent 17557c7d73
commit 5fb4bd8083
9905 changed files with 1258996 additions and 36355 deletions

13
node_modules/d3-random/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,13 @@
Copyright 2010-2021 Mike Bostock
Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.

133
node_modules/d3-random/README.md generated vendored Normal file
View File

@@ -0,0 +1,133 @@
# d3-random
Generate random numbers from various distributions.
See the [d3-random collection on Observable](https://observablehq.com/collection/@d3/d3-random) for examples.
## Installing
If you use npm, `npm install d3-random`. You can also download the [latest release on GitHub](https://github.com/d3/d3-random/releases/latest). For vanilla HTML in modern browsers, import d3-random from Skypack:
```html
<script type="module">
import {randomUniform} from "https://cdn.skypack.dev/d3-random@3";
const random = randomUniform(1, 10);
</script>
```
For legacy environments, you can load d3-randoms UMD bundle from an npm-based CDN such as jsDelivr; a `d3` global is exported:
```html
<script src="https://cdn.jsdelivr.net/npm/d3-random@3"></script>
<script>
const random = d3.randomUniform(1, 10);
</script>
```
## API Reference
<a name="randomUniform" href="#randomUniform">#</a> d3.<b>randomUniform</b>([<i>min</i>, ][<i>max</i>]) · [Source](https://github.com/d3/d3-random/blob/master/src/uniform.js), [Examples](https://observablehq.com/@d3/d3-random#uniform)
Returns a function for generating random numbers with a [uniform distribution](https://en.wikipedia.org/wiki/Uniform_distribution_\(continuous\)). The minimum allowed value of a returned number is *min* (inclusive), and the maximum is *max* (exclusive). If *min* is not specified, it defaults to 0; if *max* is not specified, it defaults to 1. For example:
```js
d3.randomUniform(6)(); // Returns a number greater than or equal to 0 and less than 6.
d3.randomUniform(1, 5)(); // Returns a number greater than or equal to 1 and less than 5.
```
<a name="randomInt" href="#randomInt">#</a> d3.<b>randomInt</b>([<i>min</i>, ][<i>max</i>]) · [Source](https://github.com/d3/d3-random/blob/master/src/int.js), [Examples](https://observablehq.com/@d3/d3-random#int)
Returns a function for generating random integers with a [uniform distribution](https://en.wikipedia.org/wiki/Uniform_distribution_\(continuous\)). The minimum allowed value of a returned number is ⌊*min*⌋ (inclusive), and the maximum is ⌊*max* - 1⌋ (inclusive). If *min* is not specified, it defaults to 0. For example:
```js
d3.randomInt(6)(); // Returns an integer greater than or equal to 0 and less than 6.
d3.randomInt(1, 5)(); // Returns an integer greater than or equal to 1 and less than 5.
```
<a name="randomNormal" href="#randomNormal">#</a> d3.<b>randomNormal</b>([<i>mu</i>][, <i>sigma</i>]) · [Source](https://github.com/d3/d3-random/blob/master/src/normal.js), [Examples](https://observablehq.com/@d3/d3-random#normal)
Returns a function for generating random numbers with a [normal (Gaussian) distribution](https://en.wikipedia.org/wiki/Normal_distribution). The expected value of the generated numbers is *mu*, with the given standard deviation *sigma*. If *mu* is not specified, it defaults to 0; if *sigma* is not specified, it defaults to 1.
<a name="randomLogNormal" href="#randomLogNormal">#</a> d3.<b>randomLogNormal</b>([<i>mu</i>][, <i>sigma</i>]) · [Source](https://github.com/d3/d3-random/blob/master/src/logNormal.js), [Examples](https://observablehq.com/@d3/d3-random#logNormal)
Returns a function for generating random numbers with a [log-normal distribution](https://en.wikipedia.org/wiki/Log-normal_distribution). The expected value of the random variables natural logarithm is *mu*, with the given standard deviation *sigma*. If *mu* is not specified, it defaults to 0; if *sigma* is not specified, it defaults to 1.
<a name="randomBates" href="#randomBates">#</a> d3.<b>randomBates</b>(<i>n</i>) · [Source](https://github.com/d3/d3-random/blob/master/src/bates.js), [Examples](https://observablehq.com/@d3/d3-random#bates)
Returns a function for generating random numbers with a [Bates distribution](https://en.wikipedia.org/wiki/Bates_distribution) with *n* independent variables. The case of fractional *n* is handled as with d3.randomIrwinHall, and d3.randomBates(0) is equivalent to d3.randomUniform().
<a name="randomIrwinHall" href="#randomIrwinHall">#</a> d3.<b>randomIrwinHall</b>(<i>n</i>) · [Source](https://github.com/d3/d3-random/blob/master/src/irwinHall.js), [Examples](https://observablehq.com/@d3/d3-random#irwinHall)
Returns a function for generating random numbers with an [IrwinHall distribution](https://en.wikipedia.org/wiki/IrwinHall_distribution) with *n* independent variables. If the fractional part of *n* is non-zero, this is treated as adding d3.randomUniform() times that fractional part to the integral part.
<a name="randomExponential" href="#randomExponential">#</a> d3.<b>randomExponential</b>(<i>lambda</i>) · [Source](https://github.com/d3/d3-random/blob/master/src/exponential.js), [Examples](https://observablehq.com/@d3/d3-random#exponential)
Returns a function for generating random numbers with an [exponential distribution](https://en.wikipedia.org/wiki/Exponential_distribution) with the rate *lambda*; equivalent to time between events in a [Poisson process](https://en.wikipedia.org/wiki/Poisson_point_process) with a mean of 1 / *lambda*. For example, exponential(1/40) generates random times between events where, on average, one event occurs every 40 units of time.
<a name="randomPareto" href="#randomPareto">#</a> d3.<b>randomPareto</b>(<i>alpha</i>) · [Source](https://github.com/d3/d3-random/blob/master/src/pareto.js), [Examples](https://observablehq.com/@d3/d3-random#pareto)
Returns a function for generating random numbers with a [Pareto distribution](https://en.wikipedia.org/wiki/Pareto_distribution) with the shape *alpha*. The value *alpha* must be a positive value.
<a name="randomBernoulli" href="#randomBernoulli">#</a> d3.<b>randomBernoulli</b>(<i>p</i>) · [Source](https://github.com/d3/d3-random/blob/master/src/bernoulli.js), [Examples](https://observablehq.com/@d3/d3-random#bernoulli)
Returns a function for generating either 1 or 0 according to a [Bernoulli distribution](https://en.wikipedia.org/wiki/Binomial_distribution) with 1 being returned with success probability *p* and 0 with failure probability *q* = 1 - *p*. The value *p* is in the range [0, 1].
<a name="randomGeometric" href="#randomGeometric">#</a> d3.<b>randomGeometric</b>(<i>p</i>) · [Source](https://github.com/d3/d3-random/blob/master/src/geometric.js), [Examples](https://observablehq.com/@d3/d3-random#geometric)
Returns a function for generating numbers with a [geometric distribution](https://en.wikipedia.org/wiki/Geometric_distribution) with success probability *p*. The value *p* is in the range [0, 1].
<a name="randomBinomial" href="#randomBinomial">#</a> d3.<b>randomBinomial</b>(<i>n</i>, <i>p</i>) · [Source](https://github.com/d3/d3-random/blob/master/src/binomial.js), [Examples](https://observablehq.com/@d3/d3-random#binomial)
Returns a function for generating random numbers with a [binomial distribution](https://en.wikipedia.org/wiki/Binomial_distribution) with *n* the number of trials and *p* the probability of success in each trial. The value *n* is greater or equal to 0, and the value *p* is in the range [0, 1].
<a name="randomGamma" href="#randomGamma">#</a> d3.<b>randomGamma</b>(<i>k</i>, [<i>theta</i>]) · [Source](https://github.com/d3/d3-random/blob/master/src/gamma.js), [Examples](https://observablehq.com/@parcly-taxel/the-gamma-and-beta-distributions)
Returns a function for generating random numbers with a [gamma distribution](https://en.wikipedia.org/wiki/Gamma_distribution) with *k* the shape parameter and *theta* the scale parameter. The value *k* must be a positive value; if *theta* is not specified, it defaults to 1.
<a name="randomBeta" href="#randomBeta">#</a> d3.<b>randomBeta</b>(<i>alpha</i>, <i>beta</i>) · [Source](https://github.com/d3/d3-random/blob/master/src/beta.js), [Examples](https://observablehq.com/@parcly-taxel/the-gamma-and-beta-distributions)
Returns a function for generating random numbers with a [beta distribution](https://en.wikipedia.org/wiki/Beta_distribution) with *alpha* and *beta* shape parameters, which must both be positive.
<a name="randomWeibull" href="#randomWeibull">#</a> d3.<b>randomWeibull</b>(<i>k</i>, [<i>a</i>], [<i>b</i>]) · [Source](https://github.com/d3/d3-random/blob/master/src/weibull.js), [Examples](https://observablehq.com/@parcly-taxel/frechet-gumbel-weibull)
Returns a function for generating random numbers with one of the [generalized extreme value distributions](https://en.wikipedia.org/wiki/Generalized_extreme_value_distribution), depending on *k*:
* If *k* is positive, the [Weibull distribution](https://en.wikipedia.org/wiki/Weibull_distribution) with shape parameter *k*
* If *k* is zero, the [Gumbel distribution](https://en.wikipedia.org/wiki/Gumbel_distribution)
* If *k* is negative, the [Fréchet distribution](https://en.wikipedia.org/wiki/Fréchet_distribution) with shape parameter *k*
In all three cases, *a* is the location parameter and *b* is the scale parameter. If *a* is not specified, it defaults to 0; if *b* is not specified, it defaults to 1.
<a name="randomCauchy" href="#randomCauchy">#</a> d3.<b>randomCauchy</b>([<i>a</i>], [<i>b</i>]) · [Source](https://github.com/d3/d3-random/blob/master/src/cauchy.js), [Examples](https://observablehq.com/@parcly-taxel/cauchy-and-logistic-distributions)
Returns a function for generating random numbers with a [Cauchy distribution](https://en.wikipedia.org/wiki/Cauchy_distribution). *a* and *b* have the same meanings and default values as in d3.randomWeibull.
<a name="randomLogistic" href="#randomLogistic">#</a> d3.<b>randomLogistic</b>([<i>a</i>], [<i>b</i>]) · [Source](https://github.com/d3/d3-random/blob/master/src/logistic.js), [Examples](https://observablehq.com/@parcly-taxel/cauchy-and-logistic-distributions)
Returns a function for generating random numbers with a [logistic distribution](https://en.wikipedia.org/wiki/Logistic_distribution). *a* and *b* have the same meanings and default values as in d3.randomWeibull.
<a name="randomPoisson" href="#randomPoisson">#</a> d3.<b>randomPoisson</b>(<i>lambda</i>) · [Source](https://github.com/d3/d3-random/blob/master/src/poisson.js), [Examples](https://observablehq.com/@parcly-taxel/the-poisson-distribution)
Returns a function for generating random numbers with a [Poisson distribution](https://en.wikipedia.org/wiki/Poisson_distribution) with mean *lambda*.
<a name="random_source" href="#random_source">#</a> <i>random</i>.<b>source</b>(<i>source</i>) · [Examples](https://observablehq.com/@d3/random-source)
Returns the same type of function for generating random numbers but where the given random number generator *source* is used as the source of randomness instead of Math.random. The given random number generator must implement the same interface as Math.random and only return values in the range [0, 1). This is useful when a seeded random number generator is preferable to Math.random. For example:
```js
import {randomLcg, randomNumber} from "d3-random";
const seed = 0.44871573888282423; // any number in [0, 1)
const random = randomNormal.source(randomLcg(seed))(0, 1);
random(); // -0.6253955998897069
```
<a name="randomLcg" href="#randomLcg">#</a> d3.<b>randomLcg</b>([<i>seed</i>]) · [Source](https://github.com/d3/d3-random/blob/master/src/lcg.js), [Examples](https://observablehq.com/@d3/d3-randomlcg)
Returns a [linear congruential generator](https://en.wikipedia.org/wiki/Linear_congruential_generator); this function can be called repeatedly to obtain pseudorandom values well-distributed on the interval [0,1) and with a long period (up to 1 billion numbers), similar to Math.random. A *seed* can be specified as a real number in the interval [0,1) or as any integer. In the latter case, only the lower 32 bits are considered. Two generators instanced with the same seed generate the same sequence, allowing to create reproducible pseudo-random experiments. If the *seed* is not specified, one is chosen using Math.random.

358
node_modules/d3-random/dist/d3-random.js generated vendored Normal file
View File

@@ -0,0 +1,358 @@
// https://d3js.org/d3-random/ v3.0.1 Copyright 2010-2021 Mike Bostock
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.d3 = global.d3 || {}));
}(this, (function (exports) { 'use strict';
var defaultSource = Math.random;
var uniform = (function sourceRandomUniform(source) {
function randomUniform(min, max) {
min = min == null ? 0 : +min;
max = max == null ? 1 : +max;
if (arguments.length === 1) max = min, min = 0;
else max -= min;
return function() {
return source() * max + min;
};
}
randomUniform.source = sourceRandomUniform;
return randomUniform;
})(defaultSource);
var int = (function sourceRandomInt(source) {
function randomInt(min, max) {
if (arguments.length < 2) max = min, min = 0;
min = Math.floor(min);
max = Math.floor(max) - min;
return function() {
return Math.floor(source() * max + min);
};
}
randomInt.source = sourceRandomInt;
return randomInt;
})(defaultSource);
var normal = (function sourceRandomNormal(source) {
function randomNormal(mu, sigma) {
var x, r;
mu = mu == null ? 0 : +mu;
sigma = sigma == null ? 1 : +sigma;
return function() {
var y;
// If available, use the second previously-generated uniform random.
if (x != null) y = x, x = null;
// Otherwise, generate a new x and y.
else do {
x = source() * 2 - 1;
y = source() * 2 - 1;
r = x * x + y * y;
} while (!r || r > 1);
return mu + sigma * y * Math.sqrt(-2 * Math.log(r) / r);
};
}
randomNormal.source = sourceRandomNormal;
return randomNormal;
})(defaultSource);
var logNormal = (function sourceRandomLogNormal(source) {
var N = normal.source(source);
function randomLogNormal() {
var randomNormal = N.apply(this, arguments);
return function() {
return Math.exp(randomNormal());
};
}
randomLogNormal.source = sourceRandomLogNormal;
return randomLogNormal;
})(defaultSource);
var irwinHall = (function sourceRandomIrwinHall(source) {
function randomIrwinHall(n) {
if ((n = +n) <= 0) return () => 0;
return function() {
for (var sum = 0, i = n; i > 1; --i) sum += source();
return sum + i * source();
};
}
randomIrwinHall.source = sourceRandomIrwinHall;
return randomIrwinHall;
})(defaultSource);
var bates = (function sourceRandomBates(source) {
var I = irwinHall.source(source);
function randomBates(n) {
// use limiting distribution at n === 0
if ((n = +n) === 0) return source;
var randomIrwinHall = I(n);
return function() {
return randomIrwinHall() / n;
};
}
randomBates.source = sourceRandomBates;
return randomBates;
})(defaultSource);
var exponential = (function sourceRandomExponential(source) {
function randomExponential(lambda) {
return function() {
return -Math.log1p(-source()) / lambda;
};
}
randomExponential.source = sourceRandomExponential;
return randomExponential;
})(defaultSource);
var pareto = (function sourceRandomPareto(source) {
function randomPareto(alpha) {
if ((alpha = +alpha) < 0) throw new RangeError("invalid alpha");
alpha = 1 / -alpha;
return function() {
return Math.pow(1 - source(), alpha);
};
}
randomPareto.source = sourceRandomPareto;
return randomPareto;
})(defaultSource);
var bernoulli = (function sourceRandomBernoulli(source) {
function randomBernoulli(p) {
if ((p = +p) < 0 || p > 1) throw new RangeError("invalid p");
return function() {
return Math.floor(source() + p);
};
}
randomBernoulli.source = sourceRandomBernoulli;
return randomBernoulli;
})(defaultSource);
var geometric = (function sourceRandomGeometric(source) {
function randomGeometric(p) {
if ((p = +p) < 0 || p > 1) throw new RangeError("invalid p");
if (p === 0) return () => Infinity;
if (p === 1) return () => 1;
p = Math.log1p(-p);
return function() {
return 1 + Math.floor(Math.log1p(-source()) / p);
};
}
randomGeometric.source = sourceRandomGeometric;
return randomGeometric;
})(defaultSource);
var gamma = (function sourceRandomGamma(source) {
var randomNormal = normal.source(source)();
function randomGamma(k, theta) {
if ((k = +k) < 0) throw new RangeError("invalid k");
// degenerate distribution if k === 0
if (k === 0) return () => 0;
theta = theta == null ? 1 : +theta;
// exponential distribution if k === 1
if (k === 1) return () => -Math.log1p(-source()) * theta;
var d = (k < 1 ? k + 1 : k) - 1 / 3,
c = 1 / (3 * Math.sqrt(d)),
multiplier = k < 1 ? () => Math.pow(source(), 1 / k) : () => 1;
return function() {
do {
do {
var x = randomNormal(),
v = 1 + c * x;
} while (v <= 0);
v *= v * v;
var u = 1 - source();
} while (u >= 1 - 0.0331 * x * x * x * x && Math.log(u) >= 0.5 * x * x + d * (1 - v + Math.log(v)));
return d * v * multiplier() * theta;
};
}
randomGamma.source = sourceRandomGamma;
return randomGamma;
})(defaultSource);
var beta = (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);
var binomial = (function sourceRandomBinomial(source) {
var G = geometric.source(source),
B = beta.source(source);
function randomBinomial(n, p) {
n = +n;
if ((p = +p) >= 1) return () => n;
if (p <= 0) return () => 0;
return function() {
var acc = 0, nn = n, pp = p;
while (nn * pp > 16 && nn * (1 - pp) > 16) {
var i = Math.floor((nn + 1) * pp),
y = B(i, nn - i + 1)();
if (y <= pp) {
acc += i;
nn -= i;
pp = (pp - y) / (1 - y);
} else {
nn = i - 1;
pp /= y;
}
}
var sign = pp < 0.5,
pFinal = sign ? pp : 1 - pp,
g = G(pFinal);
for (var s = g(), k = 0; s <= nn; ++k) s += g();
return acc + (sign ? k : nn - k);
};
}
randomBinomial.source = sourceRandomBinomial;
return randomBinomial;
})(defaultSource);
var weibull = (function sourceRandomWeibull(source) {
function randomWeibull(k, a, b) {
var outerFunc;
if ((k = +k) === 0) {
outerFunc = x => -Math.log(x);
} else {
k = 1 / k;
outerFunc = x => Math.pow(x, k);
}
a = a == null ? 0 : +a;
b = b == null ? 1 : +b;
return function() {
return a + b * outerFunc(-Math.log1p(-source()));
};
}
randomWeibull.source = sourceRandomWeibull;
return randomWeibull;
})(defaultSource);
var cauchy = (function sourceRandomCauchy(source) {
function randomCauchy(a, b) {
a = a == null ? 0 : +a;
b = b == null ? 1 : +b;
return function() {
return a + b * Math.tan(Math.PI * source());
};
}
randomCauchy.source = sourceRandomCauchy;
return randomCauchy;
})(defaultSource);
var logistic = (function sourceRandomLogistic(source) {
function randomLogistic(a, b) {
a = a == null ? 0 : +a;
b = b == null ? 1 : +b;
return function() {
var u = source();
return a + b * Math.log(u / (1 - u));
};
}
randomLogistic.source = sourceRandomLogistic;
return randomLogistic;
})(defaultSource);
var poisson = (function sourceRandomPoisson(source) {
var G = gamma.source(source),
B = binomial.source(source);
function randomPoisson(lambda) {
return function() {
var acc = 0, l = lambda;
while (l > 16) {
var n = Math.floor(0.875 * l),
t = G(n)();
if (t > l) return acc + B(n - 1, l / t)();
acc += n;
l -= t;
}
for (var s = -Math.log1p(-source()), k = 0; s <= l; ++k) s -= Math.log1p(-source());
return acc + k;
};
}
randomPoisson.source = sourceRandomPoisson;
return randomPoisson;
})(defaultSource);
// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use
const mul = 0x19660D;
const inc = 0x3C6EF35F;
const eps = 1 / 0x100000000;
function lcg(seed = Math.random()) {
let state = (0 <= seed && seed < 1 ? seed / eps : Math.abs(seed)) | 0;
return () => (state = mul * state + inc | 0, eps * (state >>> 0));
}
exports.randomBates = bates;
exports.randomBernoulli = bernoulli;
exports.randomBeta = beta;
exports.randomBinomial = binomial;
exports.randomCauchy = cauchy;
exports.randomExponential = exponential;
exports.randomGamma = gamma;
exports.randomGeometric = geometric;
exports.randomInt = int;
exports.randomIrwinHall = irwinHall;
exports.randomLcg = lcg;
exports.randomLogNormal = logNormal;
exports.randomLogistic = logistic;
exports.randomNormal = normal;
exports.randomPareto = pareto;
exports.randomPoisson = poisson;
exports.randomUniform = uniform;
exports.randomWeibull = weibull;
Object.defineProperty(exports, '__esModule', { value: true });
})));

2
node_modules/d3-random/dist/d3-random.min.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
// https://d3js.org/d3-random/ v3.0.1 Copyright 2010-2021 Mike Bostock
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((n="undefined"!=typeof globalThis?globalThis:n||self).d3=n.d3||{})}(this,(function(n){"use strict";var r=Math.random,t=function n(r){function t(n,t){return n=null==n?0:+n,t=null==t?1:+t,1===arguments.length?(t=n,n=0):t-=n,function(){return r()*t+n}}return t.source=n,t}(r),o=function n(r){function t(n,t){return arguments.length<2&&(t=n,n=0),n=Math.floor(n),t=Math.floor(t)-n,function(){return Math.floor(r()*t+n)}}return t.source=n,t}(r),u=function n(r){function t(n,t){var o,u;return n=null==n?0:+n,t=null==t?1:+t,function(){var e;if(null!=o)e=o,o=null;else do{o=2*r()-1,e=2*r()-1,u=o*o+e*e}while(!u||u>1);return n+t*e*Math.sqrt(-2*Math.log(u)/u)}}return t.source=n,t}(r),e=function n(r){var t=u.source(r);function o(){var n=t.apply(this,arguments);return function(){return Math.exp(n())}}return o.source=n,o}(r),a=function n(r){function t(n){return(n=+n)<=0?()=>0:function(){for(var t=0,o=n;o>1;--o)t+=r();return t+o*r()}}return t.source=n,t}(r),i=function n(r){var t=a.source(r);function o(n){if(0==(n=+n))return r;var o=t(n);return function(){return o()/n}}return o.source=n,o}(r),c=function n(r){function t(n){return function(){return-Math.log1p(-r())/n}}return t.source=n,t}(r),f=function n(r){function t(n){if((n=+n)<0)throw new RangeError("invalid alpha");return n=1/-n,function(){return Math.pow(1-r(),n)}}return t.source=n,t}(r),l=function n(r){function t(n){if((n=+n)<0||n>1)throw new RangeError("invalid p");return function(){return Math.floor(r()+n)}}return t.source=n,t}(r),h=function n(r){function t(n){if((n=+n)<0||n>1)throw new RangeError("invalid p");return 0===n?()=>1/0:1===n?()=>1:(n=Math.log1p(-n),function(){return 1+Math.floor(Math.log1p(-r())/n)})}return t.source=n,t}(r),s=function n(r){var t=u.source(r)();function o(n,o){if((n=+n)<0)throw new RangeError("invalid k");if(0===n)return()=>0;if(o=null==o?1:+o,1===n)return()=>-Math.log1p(-r())*o;var u=(n<1?n+1:n)-1/3,e=1/(3*Math.sqrt(u)),a=n<1?()=>Math.pow(r(),1/n):()=>1;return function(){do{do{var n=t(),i=1+e*n}while(i<=0);i*=i*i;var c=1-r()}while(c>=1-.0331*n*n*n*n&&Math.log(c)>=.5*n*n+u*(1-i+Math.log(i)));return u*i*a()*o}}return o.source=n,o}(r),d=function n(r){var t=s.source(r);function o(n,r){var o=t(n),u=t(r);return function(){var n=o();return 0===n?0:n/(n+u())}}return o.source=n,o}(r),M=function n(r){var t=h.source(r),o=d.source(r);function u(n,r){return n=+n,(r=+r)>=1?()=>n:r<=0?()=>0:function(){for(var u=0,e=n,a=r;e*a>16&&e*(1-a)>16;){var i=Math.floor((e+1)*a),c=o(i,e-i+1)();c<=a?(u+=i,e-=i,a=(a-c)/(1-c)):(e=i-1,a/=c)}for(var f=a<.5,l=t(f?a:1-a),h=l(),s=0;h<=e;++s)h+=l();return u+(f?s:e-s)}}return u.source=n,u}(r),v=function n(r){function t(n,t,o){var u;return 0==(n=+n)?u=n=>-Math.log(n):(n=1/n,u=r=>Math.pow(r,n)),t=null==t?0:+t,o=null==o?1:+o,function(){return t+o*u(-Math.log1p(-r()))}}return t.source=n,t}(r),m=function n(r){function t(n,t){return n=null==n?0:+n,t=null==t?1:+t,function(){return n+t*Math.tan(Math.PI*r())}}return t.source=n,t}(r),p=function n(r){function t(n,t){return n=null==n?0:+n,t=null==t?1:+t,function(){var o=r();return n+t*Math.log(o/(1-o))}}return t.source=n,t}(r),g=function n(r){var t=s.source(r),o=M.source(r);function u(n){return function(){for(var u=0,e=n;e>16;){var a=Math.floor(.875*e),i=t(a)();if(i>e)return u+o(a-1,e/i)();u+=a,e-=i}for(var c=-Math.log1p(-r()),f=0;c<=e;++f)c-=Math.log1p(-r());return u+f}}return u.source=n,u}(r);const w=1/4294967296;n.randomBates=i,n.randomBernoulli=l,n.randomBeta=d,n.randomBinomial=M,n.randomCauchy=m,n.randomExponential=c,n.randomGamma=s,n.randomGeometric=h,n.randomInt=o,n.randomIrwinHall=a,n.randomLcg=function(n=Math.random()){let r=0|(0<=n&&n<1?n/w:Math.abs(n));return()=>(r=1664525*r+1013904223|0,w*(r>>>0))},n.randomLogNormal=e,n.randomLogistic=p,n.randomNormal=u,n.randomPareto=f,n.randomPoisson=g,n.randomUniform=t,n.randomWeibull=v,Object.defineProperty(n,"__esModule",{value:!0})}));

51
node_modules/d3-random/package.json generated vendored Normal file
View File

@@ -0,0 +1,51 @@
{
"name": "d3-random",
"version": "3.0.1",
"description": "Generate random numbers from various distributions.",
"homepage": "https://d3js.org/d3-random/",
"repository": {
"type": "git",
"url": "https://github.com/d3/d3-random.git"
},
"keywords": [
"d3",
"d3-module",
"random",
"rng"
],
"license": "ISC",
"author": {
"name": "Mike Bostock",
"url": "http://bost.ocks.org/mike"
},
"type": "module",
"files": [
"dist/**/*.js",
"src/**/*.js"
],
"module": "src/index.js",
"main": "src/index.js",
"jsdelivr": "dist/d3-random.min.js",
"unpkg": "dist/d3-random.min.js",
"exports": {
"umd": "./dist/d3-random.min.js",
"default": "./src/index.js"
},
"sideEffects": false,
"devDependencies": {
"d3-array": "1 - 2",
"eslint": "7",
"jsdom": "16",
"mocha": "8",
"rollup": "2",
"rollup-plugin-terser": "7"
},
"scripts": {
"test": "mocha 'test/**/*-test.js' && eslint src test",
"prepublishOnly": "rm -rf dist && yarn test && rollup -c",
"postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd -"
},
"engines": {
"node": ">=12"
}
}

19
node_modules/d3-random/src/bates.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
import defaultSource from "./defaultSource.js";
import irwinHall from "./irwinHall.js";
export default (function sourceRandomBates(source) {
var I = irwinHall.source(source);
function randomBates(n) {
// use limiting distribution at n === 0
if ((n = +n) === 0) return source;
var randomIrwinHall = I(n);
return function() {
return randomIrwinHall() / n;
};
}
randomBates.source = sourceRandomBates;
return randomBates;
})(defaultSource);

14
node_modules/d3-random/src/bernoulli.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import defaultSource from "./defaultSource.js";
export default (function sourceRandomBernoulli(source) {
function randomBernoulli(p) {
if ((p = +p) < 0 || p > 1) throw new RangeError("invalid p");
return function() {
return Math.floor(source() + p);
};
}
randomBernoulli.source = sourceRandomBernoulli;
return randomBernoulli;
})(defaultSource);

19
node_modules/d3-random/src/beta.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
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);

38
node_modules/d3-random/src/binomial.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
import defaultSource from "./defaultSource.js";
import beta from "./beta.js";
import geometric from "./geometric.js";
export default (function sourceRandomBinomial(source) {
var G = geometric.source(source),
B = beta.source(source);
function randomBinomial(n, p) {
n = +n;
if ((p = +p) >= 1) return () => n;
if (p <= 0) return () => 0;
return function() {
var acc = 0, nn = n, pp = p;
while (nn * pp > 16 && nn * (1 - pp) > 16) {
var i = Math.floor((nn + 1) * pp),
y = B(i, nn - i + 1)();
if (y <= pp) {
acc += i;
nn -= i;
pp = (pp - y) / (1 - y);
} else {
nn = i - 1;
pp /= y;
}
}
var sign = pp < 0.5,
pFinal = sign ? pp : 1 - pp,
g = G(pFinal);
for (var s = g(), k = 0; s <= nn; ++k) s += g();
return acc + (sign ? k : nn - k);
};
}
randomBinomial.source = sourceRandomBinomial;
return randomBinomial;
})(defaultSource);

15
node_modules/d3-random/src/cauchy.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
import defaultSource from "./defaultSource.js";
export default (function sourceRandomCauchy(source) {
function randomCauchy(a, b) {
a = a == null ? 0 : +a;
b = b == null ? 1 : +b;
return function() {
return a + b * Math.tan(Math.PI * source());
};
}
randomCauchy.source = sourceRandomCauchy;
return randomCauchy;
})(defaultSource);

1
node_modules/d3-random/src/defaultSource.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export default Math.random;

13
node_modules/d3-random/src/exponential.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import defaultSource from "./defaultSource.js";
export default (function sourceRandomExponential(source) {
function randomExponential(lambda) {
return function() {
return -Math.log1p(-source()) / lambda;
};
}
randomExponential.source = sourceRandomExponential;
return randomExponential;
})(defaultSource);

34
node_modules/d3-random/src/gamma.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import defaultSource from "./defaultSource.js";
import normal from "./normal.js";
export default (function sourceRandomGamma(source) {
var randomNormal = normal.source(source)();
function randomGamma(k, theta) {
if ((k = +k) < 0) throw new RangeError("invalid k");
// degenerate distribution if k === 0
if (k === 0) return () => 0;
theta = theta == null ? 1 : +theta;
// exponential distribution if k === 1
if (k === 1) return () => -Math.log1p(-source()) * theta;
var d = (k < 1 ? k + 1 : k) - 1 / 3,
c = 1 / (3 * Math.sqrt(d)),
multiplier = k < 1 ? () => Math.pow(source(), 1 / k) : () => 1;
return function() {
do {
do {
var x = randomNormal(),
v = 1 + c * x;
} while (v <= 0);
v *= v * v;
var u = 1 - source();
} while (u >= 1 - 0.0331 * x * x * x * x && Math.log(u) >= 0.5 * x * x + d * (1 - v + Math.log(v)));
return d * v * multiplier() * theta;
};
}
randomGamma.source = sourceRandomGamma;
return randomGamma;
})(defaultSource);

17
node_modules/d3-random/src/geometric.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import defaultSource from "./defaultSource.js";
export default (function sourceRandomGeometric(source) {
function randomGeometric(p) {
if ((p = +p) < 0 || p > 1) throw new RangeError("invalid p");
if (p === 0) return () => Infinity;
if (p === 1) return () => 1;
p = Math.log1p(-p);
return function() {
return 1 + Math.floor(Math.log1p(-source()) / p);
};
}
randomGeometric.source = sourceRandomGeometric;
return randomGeometric;
})(defaultSource);

18
node_modules/d3-random/src/index.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
export {default as randomUniform} from "./uniform.js";
export {default as randomInt} from "./int.js";
export {default as randomNormal} from "./normal.js";
export {default as randomLogNormal} from "./logNormal.js";
export {default as randomBates} from "./bates.js";
export {default as randomIrwinHall} from "./irwinHall.js";
export {default as randomExponential} from "./exponential.js";
export {default as randomPareto} from "./pareto.js";
export {default as randomBernoulli} from "./bernoulli.js";
export {default as randomGeometric} from "./geometric.js";
export {default as randomBinomial} from "./binomial.js";
export {default as randomGamma} from "./gamma.js";
export {default as randomBeta} from "./beta.js";
export {default as randomWeibull} from "./weibull.js";
export {default as randomCauchy} from "./cauchy.js";
export {default as randomLogistic} from "./logistic.js";
export {default as randomPoisson} from "./poisson.js";
export {default as randomLcg} from "./lcg.js";

16
node_modules/d3-random/src/int.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
import defaultSource from "./defaultSource.js";
export default (function sourceRandomInt(source) {
function randomInt(min, max) {
if (arguments.length < 2) max = min, min = 0;
min = Math.floor(min);
max = Math.floor(max) - min;
return function() {
return Math.floor(source() * max + min);
};
}
randomInt.source = sourceRandomInt;
return randomInt;
})(defaultSource);

15
node_modules/d3-random/src/irwinHall.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
import defaultSource from "./defaultSource.js";
export default (function sourceRandomIrwinHall(source) {
function randomIrwinHall(n) {
if ((n = +n) <= 0) return () => 0;
return function() {
for (var sum = 0, i = n; i > 1; --i) sum += source();
return sum + i * source();
};
}
randomIrwinHall.source = sourceRandomIrwinHall;
return randomIrwinHall;
})(defaultSource);

9
node_modules/d3-random/src/lcg.js generated vendored Normal file
View File

@@ -0,0 +1,9 @@
// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use
const mul = 0x19660D;
const inc = 0x3C6EF35F;
const eps = 1 / 0x100000000;
export default function lcg(seed = Math.random()) {
let state = (0 <= seed && seed < 1 ? seed / eps : Math.abs(seed)) | 0;
return () => (state = mul * state + inc | 0, eps * (state >>> 0));
}

17
node_modules/d3-random/src/logNormal.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import defaultSource from "./defaultSource.js";
import normal from "./normal.js";
export default (function sourceRandomLogNormal(source) {
var N = normal.source(source);
function randomLogNormal() {
var randomNormal = N.apply(this, arguments);
return function() {
return Math.exp(randomNormal());
};
}
randomLogNormal.source = sourceRandomLogNormal;
return randomLogNormal;
})(defaultSource);

16
node_modules/d3-random/src/logistic.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
import defaultSource from "./defaultSource.js";
export default (function sourceRandomLogistic(source) {
function randomLogistic(a, b) {
a = a == null ? 0 : +a;
b = b == null ? 1 : +b;
return function() {
var u = source();
return a + b * Math.log(u / (1 - u));
};
}
randomLogistic.source = sourceRandomLogistic;
return randomLogistic;
})(defaultSource);

28
node_modules/d3-random/src/normal.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
import defaultSource from "./defaultSource.js";
export default (function sourceRandomNormal(source) {
function randomNormal(mu, sigma) {
var x, r;
mu = mu == null ? 0 : +mu;
sigma = sigma == null ? 1 : +sigma;
return function() {
var y;
// If available, use the second previously-generated uniform random.
if (x != null) y = x, x = null;
// Otherwise, generate a new x and y.
else do {
x = source() * 2 - 1;
y = source() * 2 - 1;
r = x * x + y * y;
} while (!r || r > 1);
return mu + sigma * y * Math.sqrt(-2 * Math.log(r) / r);
};
}
randomNormal.source = sourceRandomNormal;
return randomNormal;
})(defaultSource);

15
node_modules/d3-random/src/pareto.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
import defaultSource from "./defaultSource.js";
export default (function sourceRandomPareto(source) {
function randomPareto(alpha) {
if ((alpha = +alpha) < 0) throw new RangeError("invalid alpha");
alpha = 1 / -alpha;
return function() {
return Math.pow(1 - source(), alpha);
};
}
randomPareto.source = sourceRandomPareto;
return randomPareto;
})(defaultSource);

27
node_modules/d3-random/src/poisson.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
import defaultSource from "./defaultSource.js";
import binomial from "./binomial.js";
import gamma from "./gamma.js";
export default (function sourceRandomPoisson(source) {
var G = gamma.source(source),
B = binomial.source(source);
function randomPoisson(lambda) {
return function() {
var acc = 0, l = lambda;
while (l > 16) {
var n = Math.floor(0.875 * l),
t = G(n)();
if (t > l) return acc + B(n - 1, l / t)();
acc += n;
l -= t;
}
for (var s = -Math.log1p(-source()), k = 0; s <= l; ++k) s -= Math.log1p(-source());
return acc + k;
};
}
randomPoisson.source = sourceRandomPoisson;
return randomPoisson;
})(defaultSource);

17
node_modules/d3-random/src/uniform.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import defaultSource from "./defaultSource.js";
export default (function sourceRandomUniform(source) {
function randomUniform(min, max) {
min = min == null ? 0 : +min;
max = max == null ? 1 : +max;
if (arguments.length === 1) max = min, min = 0;
else max -= min;
return function() {
return source() * max + min;
};
}
randomUniform.source = sourceRandomUniform;
return randomUniform;
})(defaultSource);

22
node_modules/d3-random/src/weibull.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
import defaultSource from "./defaultSource.js";
export default (function sourceRandomWeibull(source) {
function randomWeibull(k, a, b) {
var outerFunc;
if ((k = +k) === 0) {
outerFunc = x => -Math.log(x);
} else {
k = 1 / k;
outerFunc = x => Math.pow(x, k);
}
a = a == null ? 0 : +a;
b = b == null ? 1 : +b;
return function() {
return a + b * outerFunc(-Math.log1p(-source()));
};
}
randomWeibull.source = sourceRandomWeibull;
return randomWeibull;
})(defaultSource);