This commit is contained in:
nik
2025-10-03 22:27:28 +03:00
parent 829fad0e17
commit 871cf7e792
16520 changed files with 2967597 additions and 3 deletions

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})}));