@numero-uno-jpn/rstats 0.15.3 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +166 -0
- package/README.ja.md +40 -33
- package/README.md +36 -28
- package/dist/chunks/chunk-2D2IQWUQ.js +2 -0
- package/dist/chunks/chunk-5UQCRBAG.js +2 -0
- package/dist/chunks/chunk-6CSTWA5E.js +2 -0
- package/dist/chunks/chunk-72Y3HZID.js +2 -0
- package/dist/chunks/chunk-BG2KLEHM.js +2 -0
- package/dist/chunks/chunk-CMEKBNHQ.js +2 -0
- package/dist/chunks/chunk-FLJNSXSW.js +2 -0
- package/dist/chunks/chunk-GM53LWSR.js +2 -0
- package/dist/chunks/chunk-JBCA56ZS.js +3 -0
- package/dist/chunks/chunk-K3RJAD2T.js +2 -0
- package/dist/chunks/chunk-KAZRWIB5.js +2 -0
- package/dist/chunks/chunk-KBVVIMXX.js +3 -0
- package/dist/chunks/chunk-N3SIFCZX.js +2 -0
- package/dist/chunks/chunk-QNNL7AZ3.js +2 -0
- package/dist/chunks/chunk-SC6CV4Z3.js +2 -0
- package/dist/chunks/chunk-SYWOBOTR.js +2 -0
- package/dist/chunks/chunk-URIO5LY5.js +2 -0
- package/dist/chunks/chunk-VTUGG2SV.js +2 -0
- package/dist/chunks/chunk-W26LRYOJ.js +2 -0
- package/dist/chunks/chunk-XHETEYVC.js +2 -0
- package/dist/chunks/{chunk-VLUL2HFW.js → chunk-YRZWONZB.js} +1 -1
- package/dist/chunks/chunk-ZGABZMWX.js +2 -0
- package/dist/data/grouping.js +20 -5
- package/dist/descriptive/basic.js +90 -8
- package/dist/descriptive/cov.js +12 -4
- package/dist/descriptive/dataFrames.d.ts +4 -2
- package/dist/descriptive/dataFrames.js +56 -18
- package/dist/descriptive/factanal.js +16 -7
- package/dist/descriptive/hist.d.ts +8 -5
- package/dist/descriptive/hist.js +71 -31
- package/dist/descriptive/missing.js +3 -1
- package/dist/descriptive/moments.js +72 -19
- package/dist/descriptive/omega.d.ts +1 -1
- package/dist/descriptive/omega.js +68 -9
- package/dist/descriptive/pivot.d.ts +21 -9
- package/dist/descriptive/pivot.js +161 -35
- package/dist/descriptive/quantile.js +2 -1
- package/dist/descriptive/rank.js +4 -1
- package/dist/descriptive/table.d.ts +3 -2
- package/dist/descriptive/table.js +24 -9
- package/dist/descriptive.js +2 -2
- package/dist/distributions/arcsine.js +19 -2
- package/dist/distributions/beta.js +24 -4
- package/dist/distributions/binomial.js +37 -14
- package/dist/distributions/bvnorm.js +11 -2
- package/dist/distributions/cauchy.js +12 -4
- package/dist/distributions/chisq.js +7 -3
- package/dist/distributions/exponential.js +5 -0
- package/dist/distributions/f.js +32 -17
- package/dist/distributions/gamma.js +27 -3
- package/dist/distributions/geometric.js +49 -13
- package/dist/distributions/hypergeometric.d.ts +5 -1
- package/dist/distributions/hypergeometric.js +93 -6
- package/dist/distributions/invgamma.js +2 -1
- package/dist/distributions/laplace.js +27 -6
- package/dist/distributions/logistic.js +4 -1
- package/dist/distributions/lognormal.js +8 -2
- package/dist/distributions/multinomial.js +54 -11
- package/dist/distributions/nbeta.js +62 -11
- package/dist/distributions/nchisq.js +30 -6
- package/dist/distributions/negbinomial.js +94 -17
- package/dist/distributions/normal.js +9 -4
- package/dist/distributions/nt.js +392 -17
- package/dist/distributions/pareto.js +4 -1
- package/dist/distributions/poisson.js +28 -3
- package/dist/distributions/signrank.js +7 -4
- package/dist/distributions/summary.js +450 -60
- package/dist/distributions/triangular.js +10 -5
- package/dist/distributions/tukey.js +5 -2
- package/dist/distributions/weibull.js +10 -0
- package/dist/distributions/wilcox.d.ts +9 -3
- package/dist/distributions/wilcox.js +155 -26
- package/dist/distributions.js +2 -2
- package/dist/htest/agreement.d.ts +3 -2
- package/dist/htest/agreement.js +76 -14
- package/dist/htest/ansariTest.d.ts +6 -1
- package/dist/htest/ansariTest.js +75 -8
- package/dist/htest/aov.d.ts +1 -1
- package/dist/htest/aov.js +48 -34
- package/dist/htest/binomTest.d.ts +5 -0
- package/dist/htest/binomTest.js +41 -17
- package/dist/htest/brunnerMunzelTest.d.ts +4 -3
- package/dist/htest/brunnerMunzelTest.js +7 -5
- package/dist/htest/chisqTest.d.ts +2 -1
- package/dist/htest/chisqTest.js +130 -43
- package/dist/htest/cor.d.ts +2 -1
- package/dist/htest/cor.js +17 -19
- package/dist/htest/core/ansari.d.ts +9 -0
- package/dist/htest/core/ansari.js +21 -1
- package/dist/htest/core/kolmogorov.d.ts +25 -0
- package/dist/htest/core/kolmogorov.js +123 -0
- package/dist/htest/core/mantelhaen.js +6 -4
- package/dist/htest/core/shapiro.d.ts +1 -1
- package/dist/htest/core/shapiro.js +5 -1
- package/dist/htest/dunnett.js +14 -5
- package/dist/htest/effectSize.d.ts +2 -0
- package/dist/htest/effectSize.js +91 -29
- package/dist/htest/fisherTest.d.ts +2 -2
- package/dist/htest/fisherTest.js +36 -18
- package/dist/htest/groups.d.ts +7 -0
- package/dist/htest/groups.js +21 -4
- package/dist/htest/ksTest.d.ts +3 -1
- package/dist/htest/ksTest.js +23 -2
- package/dist/htest/leveneTest.js +19 -3
- package/dist/htest/mantelhaenTest.js +125 -25
- package/dist/htest/mcnemarTest.js +32 -11
- package/dist/htest/multipleComparisons.d.ts +8 -1
- package/dist/htest/multipleComparisons.js +44 -21
- package/dist/htest/normalityTests.js +44 -10
- package/dist/htest/onewayTest.js +96 -5
- package/dist/htest/pAdjust.d.ts +3 -2
- package/dist/htest/pAdjust.js +38 -6
- package/dist/htest/pairwise.d.ts +1 -1
- package/dist/htest/pairwise.js +17 -15
- package/dist/htest/poissonTest.d.ts +1 -1
- package/dist/htest/poissonTest.js +111 -59
- package/dist/htest/polycor.js +27 -7
- package/dist/htest/power.d.ts +11 -1
- package/dist/htest/power.js +112 -8
- package/dist/htest/propTest.js +21 -4
- package/dist/htest/pwr.js +121 -24
- package/dist/htest/rankTests.js +29 -5
- package/dist/htest/tTest.js +44 -21
- package/dist/htest/trendTests.d.ts +7 -3
- package/dist/htest/trendTests.js +114 -20
- package/dist/htest/types.d.ts +5 -0
- package/dist/htest/types.js +7 -0
- package/dist/htest/varTest.js +45 -14
- package/dist/htest/wilcoxTest.js +114 -21
- package/dist/integrate/quadpack.js +27 -5
- package/dist/internal/covmat.d.ts +5 -0
- package/dist/internal/covmat.js +20 -0
- package/dist/internal/ddexp.d.ts +15 -1
- package/dist/internal/ddexp.js +59 -6
- package/dist/internal/discrete.d.ts +14 -0
- package/dist/internal/discrete.js +78 -5
- package/dist/internal/extremes.d.ts +9 -0
- package/dist/internal/extremes.js +24 -0
- package/dist/internal/fround.js +13 -4
- package/dist/internal/integer.d.ts +9 -0
- package/dist/internal/integer.js +12 -0
- package/dist/internal/invert.js +15 -2
- package/dist/internal/scaledInverse.d.ts +10 -0
- package/dist/internal/scaledInverse.js +22 -0
- package/dist/internal/seq.js +15 -2
- package/dist/internal/summary.d.ts +90 -0
- package/dist/internal/summary.js +458 -39
- package/dist/internal/uniroot.d.ts +7 -0
- package/dist/internal/uniroot.js +28 -3
- package/dist/linalg/basic.d.ts +3 -1
- package/dist/linalg/basic.js +51 -7
- package/dist/linalg/chol.js +4 -1
- package/dist/linalg/dot.d.ts +29 -0
- package/dist/linalg/dot.js +132 -0
- package/dist/linalg/eigen.d.ts +6 -1
- package/dist/linalg/eigen.js +71 -14
- package/dist/linalg/expm.d.ts +3 -2
- package/dist/linalg/expm.js +109 -15
- package/dist/linalg/kappa.js +58 -10
- package/dist/linalg/lu.d.ts +2 -1
- package/dist/linalg/lu.js +35 -5
- package/dist/linalg/matrix.d.ts +14 -0
- package/dist/linalg/matrix.js +24 -0
- package/dist/linalg/ops.js +60 -13
- package/dist/linalg/qr.d.ts +2 -1
- package/dist/linalg/qr.js +91 -23
- package/dist/linalg/schur.js +11 -3
- package/dist/linalg/solve.d.ts +6 -1
- package/dist/linalg/solve.js +147 -26
- package/dist/linalg/svd.d.ts +9 -2
- package/dist/linalg/svd.js +29 -11
- package/dist/linalg.js +2 -2
- package/dist/mixed.js +4 -4
- package/dist/models/anovaSequential.d.ts +16 -1
- package/dist/models/anovaSequential.js +124 -25
- package/dist/models/aovEz.js +140 -30
- package/dist/models/aovStrata.js +55 -22
- package/dist/models/carAnova.d.ts +1 -1
- package/dist/models/carAnova.js +83 -32
- package/dist/models/coxph.js +148 -66
- package/dist/models/estimable.d.ts +15 -0
- package/dist/models/estimable.js +68 -0
- package/dist/models/formula.d.ts +1 -1
- package/dist/models/formula.js +26 -8
- package/dist/models/glm.d.ts +35 -5
- package/dist/models/glm.js +398 -55
- package/dist/models/glmAnova.js +84 -13
- package/dist/models/glmConfint.d.ts +1 -1
- package/dist/models/glmConfint.js +115 -27
- package/dist/models/glmFamily.d.ts +10 -0
- package/dist/models/glmFamily.js +244 -40
- package/dist/models/lm.d.ts +12 -1
- package/dist/models/lm.js +235 -36
- package/dist/models/lmer.d.ts +20 -1
- package/dist/models/lmer.js +109 -27
- package/dist/models/lmerAnova.js +37 -4
- package/dist/models/lmerHypotheses.d.ts +6 -2
- package/dist/models/lmerHypotheses.js +14 -2
- package/dist/models/lmerTest.d.ts +9 -2
- package/dist/models/lmerTest.js +64 -19
- package/dist/models/mauchly.d.ts +4 -1
- package/dist/models/mauchly.js +34 -13
- package/dist/models/mixedStructure.js +6 -0
- package/dist/models/modelFrame.js +8 -2
- package/dist/models/modelMatrix.d.ts +3 -1
- package/dist/models/modelMatrix.js +40 -15
- package/dist/models/scaledTables.d.ts +8 -0
- package/dist/models/scaledTables.js +6 -0
- package/dist/models/survival.d.ts +6 -1
- package/dist/models/survival.js +67 -27
- package/dist/models/tiedTimes.d.ts +2 -0
- package/dist/models/tiedTimes.js +34 -0
- package/dist/numerics/deriv.d.ts +1 -1
- package/dist/numerics/deriv.js +64 -8
- package/dist/numerics/integrate.d.ts +9 -1
- package/dist/numerics/integrate.js +103 -16
- package/dist/numerics/interp.d.ts +8 -2
- package/dist/numerics/interp.js +352 -50
- package/dist/numerics/ode.js +55 -1
- package/dist/numerics.js +2 -2
- package/dist/optim/localmin.js +4 -0
- package/dist/optim/optim.d.ts +3 -1
- package/dist/optim/optim.js +80 -8
- package/dist/random/beta.js +53 -4
- package/dist/random/binomial.d.ts +14 -3
- package/dist/random/binomial.js +59 -24
- package/dist/random/continuous.js +33 -5
- package/dist/random/extra.js +42 -9
- package/dist/random/gamma.d.ts +4 -1
- package/dist/random/gamma.js +36 -8
- package/dist/random/hyper.js +9 -6
- package/dist/random/mt.js +17 -2
- package/dist/random/poisson.js +26 -3
- package/dist/random/r2dtable.d.ts +8 -1
- package/dist/random/r2dtable.js +24 -3
- package/dist/random/rank.d.ts +2 -0
- package/dist/random/rank.js +44 -4
- package/dist/random/sample.d.ts +12 -2
- package/dist/random/sample.js +57 -20
- package/dist/random/streams.js +4 -2
- package/dist/rstats.js +14 -14
- package/dist/special/besselIK.d.ts +12 -0
- package/dist/special/besselIK.js +168 -23
- package/dist/special/besselJY.d.ts +11 -1
- package/dist/special/besselJY.js +127 -19
- package/dist/special/besselSeries.d.ts +27 -0
- package/dist/special/besselSeries.js +45 -2
- package/dist/special/beta.js +4 -1
- package/dist/special/choose.js +17 -8
- package/dist/special/dd.js +122 -18
- package/dist/special/extra.js +14 -2
- package/dist/special/gamma.js +11 -2
- package/dist/special/incbet.js +30 -4
- package/dist/special/incbetTemme.d.ts +7 -0
- package/dist/special/incbetTemme.js +45 -12
- package/dist/special/loader.d.ts +1 -1
- package/dist/special/loader.js +117 -20
- package/dist/special/log1pmx.js +4 -0
- package/dist/special.js +2 -2
- package/dist/tests.js +11 -11
- package/llms.txt +12 -6
- package/package.json +1 -1
- package/dist/chunks/chunk-3THFTB36.js +0 -2
- package/dist/chunks/chunk-3TSWYE5L.js +0 -2
- package/dist/chunks/chunk-3WPU6LGK.js +0 -2
- package/dist/chunks/chunk-5ITR67MB.js +0 -2
- package/dist/chunks/chunk-5NRFU6F6.js +0 -2
- package/dist/chunks/chunk-E2LCSVQV.js +0 -2
- package/dist/chunks/chunk-FCNVTIPJ.js +0 -2
- package/dist/chunks/chunk-FKAKALOZ.js +0 -2
- package/dist/chunks/chunk-HD73UKPT.js +0 -2
- package/dist/chunks/chunk-IUULP3LE.js +0 -2
- package/dist/chunks/chunk-JQG3YQOC.js +0 -2
- package/dist/chunks/chunk-KT66SB7R.js +0 -2
- package/dist/chunks/chunk-MAUAOQG3.js +0 -2
- package/dist/chunks/chunk-MDYE7QP2.js +0 -2
- package/dist/chunks/chunk-NM3Z2UBQ.js +0 -2
- package/dist/chunks/chunk-PMJI5QO6.js +0 -3
- package/dist/chunks/chunk-UF7KOTHF.js +0 -3
- package/dist/chunks/chunk-UOE57JGT.js +0 -2
- package/dist/chunks/chunk-USPEBXSR.js +0 -2
- package/dist/chunks/chunk-ZIX7NYQF.js +0 -2
package/dist/random/sample.js
CHANGED
|
@@ -7,13 +7,15 @@
|
|
|
7
7
|
// and the order of equal weights also matches R.
|
|
8
8
|
// All of this was verified against observed R output.
|
|
9
9
|
import { isRounding, unifIndex, unifRand } from "./rng.js";
|
|
10
|
+
import { maxOf } from "../internal/extremes.js";
|
|
10
11
|
/**
|
|
11
12
|
* Random sample of integers from `0..n-1`. Equivalent to R's `sample.int()`. Unlike R, it is 0-based.
|
|
12
13
|
*
|
|
13
14
|
* The result is R's `sample.int(n, ...)` minus 1, so it can be used directly as array
|
|
14
15
|
* indices. It consumes the same random numbers as R (default `sample.kind = "Rejection"`).
|
|
15
16
|
*
|
|
16
|
-
* @param n Number of candidates
|
|
17
|
+
* @param n Number of candidates: a non-negative number up to 4.5e15 (2^52, as R); below 2^31 with `prob`, and for
|
|
18
|
+
* sampling without replacement more than n / 2 of them.
|
|
17
19
|
* @param options See {@link SampleOptions}.
|
|
18
20
|
* @returns The drawn integers, each in `0..n-1`.
|
|
19
21
|
*
|
|
@@ -36,21 +38,27 @@ function sampleInt1(n, options) {
|
|
|
36
38
|
const { replace = false, prob } = options;
|
|
37
39
|
const sizeGiven = options.size !== undefined;
|
|
38
40
|
const size = sizeGiven ? options.size : n;
|
|
39
|
-
|
|
41
|
+
// truncated first, as R: a size in (-1, 0) is 0 (#94)
|
|
42
|
+
if (!Number.isFinite(size) || size <= -1)
|
|
40
43
|
throw new RangeError("size must be a non-negative number");
|
|
41
44
|
const k = Math.trunc(size);
|
|
45
|
+
if (n === 0 && k > 0)
|
|
46
|
+
throw new RangeError("cannot take a sample from an empty population");
|
|
42
47
|
if (prob !== undefined) {
|
|
48
|
+
// R's weighted path takes size as an integer: 2^31 or more is rejected before any allocation or draw (#414)
|
|
49
|
+
if (k >= 2 ** 31)
|
|
50
|
+
throw new RangeError("size must be less than 2^31 with prob");
|
|
43
51
|
if (n >= 2 ** 31)
|
|
44
52
|
throw new RangeError("n must be less than 2^31 with prob");
|
|
45
53
|
if (prob.length !== n)
|
|
46
54
|
throw new TypeError("prob must have length n");
|
|
47
55
|
const p = fixupProb(prob, k, replace);
|
|
48
56
|
if (replace) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return
|
|
57
|
+
const draw = replaceDrawer(p);
|
|
58
|
+
const out = new Array(k);
|
|
59
|
+
for (let i = 0; i < k; i++)
|
|
60
|
+
out[i] = draw();
|
|
61
|
+
return out;
|
|
54
62
|
}
|
|
55
63
|
if (k > n)
|
|
56
64
|
throw new RangeError("cannot take a sample larger than the population when replace is false");
|
|
@@ -90,6 +98,31 @@ function sampleInt1(n, options) {
|
|
|
90
98
|
}
|
|
91
99
|
return out;
|
|
92
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* One draw at a time from 0..n-1 with replacement and weights `prob`: the same draws, from the same uniforms, as
|
|
103
|
+
* consecutive elements of `sampleInt(n, { size, replace: true, prob })` (the method depends only on n and prob), with
|
|
104
|
+
* the same checks of n and prob. For simulations that count draws without keeping them (internal; #287)
|
|
105
|
+
*/
|
|
106
|
+
export function sampleIntReplaceDrawer(n, prob) {
|
|
107
|
+
if (!Number.isFinite(n) || n < 0 || n > 4.5e15)
|
|
108
|
+
throw new RangeError("n must be a non-negative number up to 4.5e15");
|
|
109
|
+
n = Math.trunc(n);
|
|
110
|
+
if (n >= 2 ** 31)
|
|
111
|
+
throw new RangeError("n must be less than 2^31 with prob");
|
|
112
|
+
if (prob.length !== n)
|
|
113
|
+
throw new TypeError("prob must have length n");
|
|
114
|
+
const draw = replaceDrawer(fixupProb(prob, 0, true));
|
|
115
|
+
return () => draw() - 1;
|
|
116
|
+
}
|
|
117
|
+
/** The weighted draw with replacement (1-based): Walker's alias method with more than 200 large weights, as R */
|
|
118
|
+
function replaceDrawer(p) {
|
|
119
|
+
const n = p.length;
|
|
120
|
+
let nc = 0;
|
|
121
|
+
for (let i = 0; i < n; i++)
|
|
122
|
+
if (n * p[i] > 0.1)
|
|
123
|
+
nc++;
|
|
124
|
+
return nc > 200 ? walkerDrawer(p) : probReplaceDrawer(p);
|
|
125
|
+
}
|
|
93
126
|
/**
|
|
94
127
|
* Random sample of the elements of an array. Equivalent to R's `sample()`.
|
|
95
128
|
*
|
|
@@ -129,6 +162,14 @@ function fixupProb(prob, k, replace) {
|
|
|
129
162
|
}
|
|
130
163
|
if (npos === 0 || (!replace && k > npos))
|
|
131
164
|
throw new RangeError("too few positive probabilities");
|
|
165
|
+
if (sum === Infinity) {
|
|
166
|
+
// Finite weights whose sum overflows: rescale by the largest before summing
|
|
167
|
+
const mx = maxOf(prob);
|
|
168
|
+
sum = 0;
|
|
169
|
+
for (const v of prob)
|
|
170
|
+
sum += v / mx;
|
|
171
|
+
return Float64Array.from(prob, (v) => v / mx / sum);
|
|
172
|
+
}
|
|
132
173
|
return Float64Array.from(prob, (v) => v / sum);
|
|
133
174
|
}
|
|
134
175
|
/** Sort a in decreasing order, permuting ib alongside (heapsort; ties end up in the same order as R) */
|
|
@@ -185,22 +226,20 @@ function sortedByWeight(p) {
|
|
|
185
226
|
revsort(p, perm);
|
|
186
227
|
return perm;
|
|
187
228
|
}
|
|
188
|
-
function
|
|
229
|
+
function probReplaceDrawer(prob) {
|
|
189
230
|
const p = Float64Array.from(prob);
|
|
190
231
|
const n = p.length;
|
|
191
232
|
const perm = sortedByWeight(p);
|
|
192
233
|
for (let i = 1; i < n; i++)
|
|
193
234
|
p[i] += p[i - 1];
|
|
194
|
-
|
|
195
|
-
for (let i = 0; i < k; i++) {
|
|
235
|
+
return () => {
|
|
196
236
|
const rU = unifRand();
|
|
197
237
|
let j = 0;
|
|
198
238
|
for (; j < n - 1; j++)
|
|
199
239
|
if (rU <= p[j])
|
|
200
240
|
break;
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
return out;
|
|
241
|
+
return perm[j];
|
|
242
|
+
};
|
|
204
243
|
}
|
|
205
244
|
function probSampleNoReplace(prob, k) {
|
|
206
245
|
const p = Float64Array.from(prob);
|
|
@@ -226,8 +265,8 @@ function probSampleNoReplace(prob, k) {
|
|
|
226
265
|
}
|
|
227
266
|
return out;
|
|
228
267
|
}
|
|
229
|
-
/** Sampling with replacement by Walker's alias method */
|
|
230
|
-
function
|
|
268
|
+
/** Sampling with replacement by Walker's alias method (one draw per call) */
|
|
269
|
+
function walkerDrawer(p) {
|
|
231
270
|
const n = p.length;
|
|
232
271
|
const q = new Float64Array(n);
|
|
233
272
|
const a = new Int32Array(n);
|
|
@@ -258,8 +297,7 @@ function walkerSample(p, k) {
|
|
|
258
297
|
// is n times one uniform; otherwise t is a uniform integer and u another uniform. The comparison is made on t + u
|
|
259
298
|
// and q[t] + t, as R does (in doubles)
|
|
260
299
|
const rounding = isRounding();
|
|
261
|
-
|
|
262
|
-
for (let i = 0; i < k; i++) {
|
|
300
|
+
return () => {
|
|
263
301
|
let t;
|
|
264
302
|
let rU;
|
|
265
303
|
if (rounding) {
|
|
@@ -270,7 +308,6 @@ function walkerSample(p, k) {
|
|
|
270
308
|
t = unifIndex(n);
|
|
271
309
|
rU = t + unifRand();
|
|
272
310
|
}
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
return out;
|
|
311
|
+
return rU < q[t] + t ? t + 1 : a[t] + 1;
|
|
312
|
+
};
|
|
276
313
|
}
|
package/dist/random/streams.js
CHANGED
|
@@ -18,8 +18,10 @@ function mulMod(a, b, m) {
|
|
|
18
18
|
}
|
|
19
19
|
function jump(state, a1, a2) {
|
|
20
20
|
const code = state[0];
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
// the kind codes setRandomSeed takes for L'Ecuyer-CMRG (R accepts any code ending in 07, such as 7, which would give a
|
|
22
|
+
// state setRandomSeed cannot restore)
|
|
23
|
+
if (code !== 10407 && code !== 407)
|
|
24
|
+
throw new RangeError("the state must be a .Random.seed of L'Ecuyer-CMRG (kind code 10407 or 407)");
|
|
23
25
|
const s = checkState(state);
|
|
24
26
|
const out = new Int32Array(7);
|
|
25
27
|
out[0] = code;
|