@numero-uno-jpn/rstats 0.11.0 → 0.11.1

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.
Files changed (269) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.ja.md +5 -4
  3. package/README.md +6 -4
  4. package/dist/chunks/{chunk-YSWGDOWK.js → chunk-2X7JYQBI.js} +2 -2
  5. package/dist/chunks/{chunk-F5EDJFEO.js → chunk-36GVER3O.js} +2 -2
  6. package/dist/chunks/{chunk-7GQMKH3Z.js → chunk-3WUXRSM6.js} +1 -1
  7. package/dist/chunks/{chunk-JWBO5WVN.js → chunk-6I6QKTFK.js} +2 -2
  8. package/dist/chunks/{chunk-EZWBRCJL.js → chunk-ETOEZTGL.js} +1 -1
  9. package/dist/chunks/{chunk-VJ4BDBMU.js → chunk-FVPDVRJQ.js} +2 -2
  10. package/dist/chunks/{chunk-EZAFN5CD.js → chunk-GG4BJMJW.js} +1 -1
  11. package/dist/chunks/{chunk-5WDJPHYY.js → chunk-HITD7CX6.js} +1 -1
  12. package/dist/chunks/{chunk-Y5PYRAYP.js → chunk-KK4GE65D.js} +2 -2
  13. package/dist/chunks/{chunk-AHHS6AC4.js → chunk-LAUYSGV4.js} +2 -2
  14. package/dist/chunks/{chunk-ALM3VHFP.js → chunk-M6GDXKKS.js} +1 -1
  15. package/dist/chunks/{chunk-C5XTWMGB.js → chunk-PHHUHR7T.js} +1 -1
  16. package/dist/chunks/{chunk-TOGXTCZO.js → chunk-WQPFDDIY.js} +2 -2
  17. package/dist/chunks/{chunk-CGBNKHNZ.js → chunk-X2AWQSVS.js} +2 -2
  18. package/dist/chunks/{chunk-Y5CNQ266.js → chunk-ZRJQD7VS.js} +2 -2
  19. package/dist/data/grouping.d.ts +33 -12
  20. package/dist/data/grouping.js +2 -0
  21. package/dist/descriptive/basic.d.ts +130 -17
  22. package/dist/descriptive/basic.js +115 -14
  23. package/dist/descriptive/cov.d.ts +22 -12
  24. package/dist/descriptive/dataFrames.d.ts +39 -11
  25. package/dist/descriptive/dataFrames.js +14 -6
  26. package/dist/descriptive/factanal.d.ts +26 -6
  27. package/dist/descriptive/factanal.js +7 -3
  28. package/dist/descriptive/hist.d.ts +27 -6
  29. package/dist/descriptive/hist.js +9 -3
  30. package/dist/descriptive/missing.d.ts +13 -6
  31. package/dist/descriptive/missing.js +4 -2
  32. package/dist/descriptive/moments.d.ts +91 -13
  33. package/dist/descriptive/moments.js +66 -9
  34. package/dist/descriptive/omega.d.ts +28 -6
  35. package/dist/descriptive/omega.js +16 -4
  36. package/dist/descriptive/pivot.d.ts +22 -6
  37. package/dist/descriptive/pivot.js +7 -3
  38. package/dist/descriptive/quantile.d.ts +33 -5
  39. package/dist/descriptive/quantile.js +20 -2
  40. package/dist/descriptive/rank.d.ts +12 -2
  41. package/dist/descriptive/rank.js +2 -0
  42. package/dist/descriptive/table.d.ts +55 -7
  43. package/dist/descriptive/table.js +38 -4
  44. package/dist/descriptive.js +2 -2
  45. package/dist/distributions/arcsine.d.ts +40 -5
  46. package/dist/distributions/arcsine.js +35 -4
  47. package/dist/distributions/beta.d.ts +12 -0
  48. package/dist/distributions/beta.js +12 -0
  49. package/dist/distributions/binomial.d.ts +18 -0
  50. package/dist/distributions/binomial.js +18 -0
  51. package/dist/distributions/bvnorm.d.ts +4 -1
  52. package/dist/distributions/bvnorm.js +4 -1
  53. package/dist/distributions/cauchy.d.ts +24 -0
  54. package/dist/distributions/cauchy.js +24 -0
  55. package/dist/distributions/chisq.d.ts +18 -0
  56. package/dist/distributions/chisq.js +18 -0
  57. package/dist/distributions/exponential.d.ts +29 -1
  58. package/dist/distributions/exponential.js +24 -0
  59. package/dist/distributions/f.d.ts +18 -0
  60. package/dist/distributions/f.js +18 -0
  61. package/dist/distributions/gamma.d.ts +20 -0
  62. package/dist/distributions/gamma.js +18 -0
  63. package/dist/distributions/geometric.d.ts +24 -0
  64. package/dist/distributions/geometric.js +24 -0
  65. package/dist/distributions/hypergeometric.d.ts +24 -0
  66. package/dist/distributions/hypergeometric.js +24 -0
  67. package/dist/distributions/invgamma.d.ts +32 -4
  68. package/dist/distributions/invgamma.js +27 -3
  69. package/dist/distributions/kumaraswamy.d.ts +31 -3
  70. package/dist/distributions/kumaraswamy.js +31 -3
  71. package/dist/distributions/laplace.d.ts +36 -4
  72. package/dist/distributions/laplace.js +31 -3
  73. package/dist/distributions/logistic.d.ts +29 -1
  74. package/dist/distributions/logistic.js +24 -0
  75. package/dist/distributions/lognormal.d.ts +29 -1
  76. package/dist/distributions/lognormal.js +24 -0
  77. package/dist/distributions/multinomial.d.ts +7 -1
  78. package/dist/distributions/multinomial.js +2 -0
  79. package/dist/distributions/negbinomial.d.ts +29 -1
  80. package/dist/distributions/negbinomial.js +24 -0
  81. package/dist/distributions/normal.d.ts +11 -1
  82. package/dist/distributions/normal.js +6 -0
  83. package/dist/distributions/pareto.d.ts +36 -4
  84. package/dist/distributions/pareto.js +31 -3
  85. package/dist/distributions/poisson.d.ts +18 -0
  86. package/dist/distributions/poisson.js +18 -0
  87. package/dist/distributions/signrank.d.ts +24 -0
  88. package/dist/distributions/signrank.js +24 -0
  89. package/dist/distributions/summary.d.ts +20 -2
  90. package/dist/distributions/summary.js +4 -0
  91. package/dist/distributions/t.d.ts +18 -0
  92. package/dist/distributions/t.js +18 -0
  93. package/dist/distributions/triangular.d.ts +36 -4
  94. package/dist/distributions/triangular.js +31 -3
  95. package/dist/distributions/tukey.d.ts +15 -1
  96. package/dist/distributions/tukey.js +10 -0
  97. package/dist/distributions/uniform.d.ts +29 -1
  98. package/dist/distributions/uniform.js +24 -0
  99. package/dist/distributions/weibull.d.ts +29 -1
  100. package/dist/distributions/weibull.js +24 -0
  101. package/dist/distributions/wilcox.d.ts +24 -0
  102. package/dist/distributions/wilcox.js +24 -0
  103. package/dist/distributions.js +2 -2
  104. package/dist/entries/descriptive.d.ts +1 -1
  105. package/dist/entries/numerics.d.ts +1 -1
  106. package/dist/entries/tests.js +1 -1
  107. package/dist/htest/agreement.d.ts +61 -23
  108. package/dist/htest/agreement.js +19 -9
  109. package/dist/htest/ansariTest.d.ts +8 -2
  110. package/dist/htest/aov.d.ts +43 -10
  111. package/dist/htest/aov.js +17 -3
  112. package/dist/htest/binomTest.d.ts +12 -2
  113. package/dist/htest/binomTest.js +2 -0
  114. package/dist/htest/brunnerMunzelTest.d.ts +9 -3
  115. package/dist/htest/brunnerMunzelTest.js +4 -2
  116. package/dist/htest/chisqTest.d.ts +19 -3
  117. package/dist/htest/cor.d.ts +20 -4
  118. package/dist/htest/effectSize.d.ts +70 -12
  119. package/dist/htest/effectSize.js +40 -7
  120. package/dist/htest/fisherTest.d.ts +9 -1
  121. package/dist/htest/fisherTest.js +2 -0
  122. package/dist/htest/groups.d.ts +5 -1
  123. package/dist/htest/ksTest.d.ts +20 -3
  124. package/dist/htest/leveneTest.d.ts +15 -4
  125. package/dist/htest/leveneTest.js +5 -2
  126. package/dist/htest/mantelhaenTest.d.ts +25 -3
  127. package/dist/htest/mantelhaenTest.js +15 -1
  128. package/dist/htest/mcnemarTest.d.ts +14 -4
  129. package/dist/htest/mcnemarTest.js +4 -2
  130. package/dist/htest/multipleComparisons.d.ts +173 -29
  131. package/dist/htest/multipleComparisons.js +123 -19
  132. package/dist/htest/normalityTests.d.ts +56 -9
  133. package/dist/htest/normalityTests.js +40 -6
  134. package/dist/htest/onewayTest.d.ts +32 -3
  135. package/dist/htest/onewayTest.js +10 -0
  136. package/dist/htest/pAdjust.d.ts +9 -1
  137. package/dist/htest/pAdjust.js +2 -0
  138. package/dist/htest/pairwise.d.ts +50 -5
  139. package/dist/htest/pairwise.js +25 -0
  140. package/dist/htest/poissonTest.d.ts +12 -2
  141. package/dist/htest/poissonTest.js +2 -0
  142. package/dist/htest/polycor.d.ts +29 -10
  143. package/dist/htest/power.d.ts +60 -6
  144. package/dist/htest/power.js +6 -0
  145. package/dist/htest/propTest.d.ts +13 -2
  146. package/dist/htest/propTest.js +2 -0
  147. package/dist/htest/pwr.d.ts +286 -36
  148. package/dist/htest/pwr.js +116 -15
  149. package/dist/htest/rankTests.d.ts +80 -12
  150. package/dist/htest/rankTests.js +11 -2
  151. package/dist/htest/tTest.d.ts +13 -3
  152. package/dist/htest/trendTests.d.ts +29 -8
  153. package/dist/htest/trendTests.js +8 -4
  154. package/dist/htest/types.d.ts +14 -2
  155. package/dist/htest/varTest.d.ts +25 -8
  156. package/dist/htest/wilcoxTest.d.ts +10 -2
  157. package/dist/internal/dpq.d.ts +4 -0
  158. package/dist/internal/noncentral.d.ts +2 -0
  159. package/dist/internal/vectorize.d.ts +4 -0
  160. package/dist/linalg/basic.d.ts +39 -5
  161. package/dist/linalg/basic.js +15 -0
  162. package/dist/linalg/chol.d.ts +26 -5
  163. package/dist/linalg/chol.js +7 -0
  164. package/dist/linalg/eigen.d.ts +16 -7
  165. package/dist/linalg/eigen.js +6 -5
  166. package/dist/linalg/expm.d.ts +15 -5
  167. package/dist/linalg/expm.js +5 -3
  168. package/dist/linalg/kappa.d.ts +21 -1
  169. package/dist/linalg/kappa.js +16 -0
  170. package/dist/linalg/lu.d.ts +30 -6
  171. package/dist/linalg/lu.js +15 -3
  172. package/dist/linalg/matrix.d.ts +4 -0
  173. package/dist/linalg/norm.d.ts +16 -1
  174. package/dist/linalg/norm.js +9 -0
  175. package/dist/linalg/ops.d.ts +156 -35
  176. package/dist/linalg/ops.js +96 -15
  177. package/dist/linalg/qr.d.ts +87 -12
  178. package/dist/linalg/qr.js +31 -0
  179. package/dist/linalg/schur.d.ts +8 -2
  180. package/dist/linalg/schur.js +3 -1
  181. package/dist/linalg/solve.d.ts +42 -6
  182. package/dist/linalg/solve.js +22 -0
  183. package/dist/linalg/svd.d.ts +12 -2
  184. package/dist/linalg/svd.js +2 -0
  185. package/dist/linalg.js +2 -2
  186. package/dist/models/anovaSequential.d.ts +26 -4
  187. package/dist/models/anovaSequential.js +3 -1
  188. package/dist/models/aovEz.d.ts +29 -6
  189. package/dist/models/aovEz.js +5 -2
  190. package/dist/models/aovStrata.d.ts +12 -2
  191. package/dist/models/carAnova.d.ts +9 -3
  192. package/dist/models/carAnova.js +4 -2
  193. package/dist/models/coxph.d.ts +33 -7
  194. package/dist/models/coxph.js +8 -3
  195. package/dist/models/glm.d.ts +128 -21
  196. package/dist/models/glm.js +71 -14
  197. package/dist/models/glmAnova.d.ts +30 -5
  198. package/dist/models/glmAnova.js +15 -2
  199. package/dist/models/glmConfint.d.ts +16 -2
  200. package/dist/models/glmConfint.js +9 -1
  201. package/dist/models/glmFamily.d.ts +27 -5
  202. package/dist/models/lm.d.ts +75 -17
  203. package/dist/models/lm.js +22 -4
  204. package/dist/models/mauchly.d.ts +20 -5
  205. package/dist/models/mauchly.js +7 -3
  206. package/dist/models/modelFrame.d.ts +5 -1
  207. package/dist/models/modelMatrix.d.ts +18 -4
  208. package/dist/models/modelMatrix.js +3 -1
  209. package/dist/models/survival.d.ts +41 -9
  210. package/dist/models/survival.js +10 -4
  211. package/dist/numerics/deriv.d.ts +21 -6
  212. package/dist/numerics/deriv.js +16 -5
  213. package/dist/numerics/integrate.d.ts +37 -7
  214. package/dist/numerics/integrate.js +8 -2
  215. package/dist/numerics/interp.d.ts +63 -12
  216. package/dist/numerics/interp.js +30 -6
  217. package/dist/numerics/ode.d.ts +15 -5
  218. package/dist/numerics/ode.js +5 -3
  219. package/dist/numerics.js +2 -2
  220. package/dist/optim/optim.d.ts +32 -8
  221. package/dist/optim/optim.js +8 -4
  222. package/dist/random/beta.d.ts +8 -0
  223. package/dist/random/beta.js +8 -0
  224. package/dist/random/binomial.d.ts +16 -0
  225. package/dist/random/binomial.js +16 -0
  226. package/dist/random/continuous.d.ts +51 -0
  227. package/dist/random/continuous.js +51 -0
  228. package/dist/random/extra.d.ts +66 -6
  229. package/dist/random/extra.js +66 -6
  230. package/dist/random/gamma.d.ts +33 -0
  231. package/dist/random/gamma.js +33 -0
  232. package/dist/random/hyper.d.ts +8 -0
  233. package/dist/random/hyper.js +8 -0
  234. package/dist/random/poisson.d.ts +25 -0
  235. package/dist/random/poisson.js +25 -0
  236. package/dist/random/r2dtable.d.ts +2 -0
  237. package/dist/random/r2dtable.js +2 -0
  238. package/dist/random/rank.d.ts +16 -0
  239. package/dist/random/rank.js +16 -0
  240. package/dist/random/rng.d.ts +49 -6
  241. package/dist/random/rng.js +29 -2
  242. package/dist/random/sample.d.ts +10 -2
  243. package/dist/random/sample.js +5 -1
  244. package/dist/random/streams.d.ts +13 -0
  245. package/dist/random/streams.js +13 -0
  246. package/dist/rstats.js +1 -1
  247. package/dist/special/besselIK.d.ts +11 -3
  248. package/dist/special/besselIK.js +6 -2
  249. package/dist/special/besselJY.d.ts +6 -2
  250. package/dist/special/besselJY.js +6 -2
  251. package/dist/special/beta.d.ts +16 -2
  252. package/dist/special/beta.js +16 -2
  253. package/dist/special/choose.d.ts +13 -5
  254. package/dist/special/choose.js +13 -5
  255. package/dist/special/erf.d.ts +8 -3
  256. package/dist/special/erf.js +8 -3
  257. package/dist/special/extra.d.ts +30 -10
  258. package/dist/special/extra.js +25 -9
  259. package/dist/special/gamma.d.ts +18 -2
  260. package/dist/special/gamma.js +18 -2
  261. package/dist/special/log1p.d.ts +16 -7
  262. package/dist/special/log1p.js +16 -7
  263. package/dist/special/psigamma.d.ts +9 -3
  264. package/dist/special/psigamma.js +9 -3
  265. package/dist/special/rCompatible.d.ts +5 -1
  266. package/dist/special.js +2 -2
  267. package/dist/tests.js +2 -2
  268. package/llms.txt +2 -0
  269. package/package.json +1 -1
@@ -46,6 +46,8 @@ function ensureSeeded() {
46
46
  * rnorm(3); // [-0.6264538107423324, 0.18364332422208224, -0.8356286124100472]
47
47
  * // R: set.seed(1); rnorm(3)
48
48
  * ```
49
+ *
50
+ * @category Random numbers
49
51
  */
50
52
  export function setSeed(seed) {
51
53
  if (!Number.isFinite(seed))
@@ -99,6 +101,8 @@ function lookup(table, name, what) {
99
101
  * sampleInt(10, { size: 3 }); // [2, 3, 4]
100
102
  * // R: set.seed(1, kind = "default", sample.kind = "Rounding"); sample.int(10, 3) - 1
101
103
  * ```
104
+ *
105
+ * @category Random numbers
102
106
  */
103
107
  export function RNGkind(options = {}) {
104
108
  const previous = {
@@ -121,12 +125,23 @@ export function RNGkind(options = {}) {
121
125
  /** Value of .Random.seed[1]: uniform kind (3 Mersenne-Twister, 7 L'Ecuyer-CMRG) + 100 × normal 4 (Inversion) + 10000 × sample kind (0 Rounding, 1 Rejection) */
122
126
  const kindCode = () => (gen === mt ? 3 : 7) + 400 + (rounding ? 0 : 10000);
123
127
  /**
124
- * Returns a copy of the current generator state. Equivalent to reading R's `.Random.seed`.
128
+ * Returns a copy of the current generator state, as reading R's `.Random.seed` does.
129
+ * Equivalent to R's `.Random.seed`.
125
130
  *
126
131
  * @returns The same integers as R's `.Random.seed`: the kind code (`10403` for R's default,
127
132
  * `403` with `sampleKind: "Rounding"`, `10407` for L'Ecuyer-CMRG), followed by 625 integers
128
133
  * for Mersenne-Twister or 6 for L'Ecuyer-CMRG (unsigned seeds of 2^31 or more appear as
129
134
  * negative numbers, as in R). Pass it to {@link setRandomSeed} to restore the state.
135
+ *
136
+ * @example
137
+ * ```ts
138
+ * setSeed(1);
139
+ * const s = getRandomSeed();
140
+ * s.length; // 626
141
+ * s[0]; // 10403
142
+ * ```
143
+ *
144
+ * @category Random numbers
130
145
  */
131
146
  export function getRandomSeed() {
132
147
  ensureSeeded();
@@ -136,12 +151,24 @@ export function getRandomSeed() {
136
151
  return Int32Array.of(kindCode(), ...gen.s);
137
152
  }
138
153
  /**
139
- * Restores a generator state, including its kinds. Equivalent to assigning R's `.Random.seed`.
154
+ * Restores a generator state, including its kinds, as assigning R's `.Random.seed` does.
155
+ * Equivalent to R's `.Random.seed`.
140
156
  *
141
157
  * @param state The integers returned by {@link getRandomSeed}, or copied from R's `.Random.seed`.
142
158
  * @throws RangeError for a kind code other than those of Mersenne-Twister or L'Ecuyer-CMRG with
143
159
  * Inversion and Rejection or Rounding (`10403`, `403`, `10407`, `407`), a state of the wrong
144
160
  * length, or an invalid L'Ecuyer-CMRG state (R reseeds from the clock in these cases).
161
+ *
162
+ * @example
163
+ * ```ts
164
+ * setSeed(1);
165
+ * const s = getRandomSeed();
166
+ * runif(2); // [0.2655087, 0.3721239]
167
+ * setRandomSeed(s);
168
+ * runif(2); // [0.2655087, 0.3721239] (the same again)
169
+ * ```
170
+ *
171
+ * @category Random numbers
145
172
  */
146
173
  export function setRandomSeed(state) {
147
174
  const code = state[0];
@@ -1,4 +1,8 @@
1
- /** Options for {@link sample} and {@link sampleInt}. */
1
+ /**
2
+ * Options for {@link sample} and {@link sampleInt}.
3
+ *
4
+ * @category Random numbers
5
+ */
2
6
  export interface SampleOptions {
3
7
  /** Number of items to draw. Default: the number of candidates (a random permutation). */
4
8
  size?: number;
@@ -8,7 +12,7 @@ export interface SampleOptions {
8
12
  prob?: readonly number[];
9
13
  }
10
14
  /**
11
- * Random sample of integers from `0..n-1`. Equivalent to R's `sample.int()`, but 0-based.
15
+ * Random sample of integers from `0..n-1`. Equivalent to R's `sample.int()`. Unlike R, it is 0-based.
12
16
  *
13
17
  * The result is R's `sample.int(n, ...)` minus 1, so it can be used directly as array
14
18
  * indices. It consumes the same random numbers as R (default `sample.kind = "Rejection"`).
@@ -22,6 +26,8 @@ export interface SampleOptions {
22
26
  * setSeed(42);
23
27
  * sampleInt(10, { size: 3 }); // [0, 4, 9] (R: set.seed(42); sample.int(10, 3) - 1)
24
28
  * ```
29
+ *
30
+ * @category Random numbers
25
31
  */
26
32
  export declare function sampleInt(n: number, options?: SampleOptions): number[];
27
33
  /**
@@ -41,5 +47,7 @@ export declare function sampleInt(n: number, options?: SampleOptions): number[];
41
47
  * sample(["a", "b", "c", "d", "e"]); // ["a", "e", "d", "c", "b"]
42
48
  * sample([1, 2, 3], { size: 5, replace: true, prob: [0.5, 0.3, 0.2] });
43
49
  * ```
50
+ *
51
+ * @category Random numbers
44
52
  */
45
53
  export declare function sample<T>(x: readonly T[], options?: SampleOptions): T[];
@@ -8,7 +8,7 @@
8
8
  // All of this was verified against observed R output.
9
9
  import { isRounding, unifIndex, unifRand } from "./rng.js";
10
10
  /**
11
- * Random sample of integers from `0..n-1`. Equivalent to R's `sample.int()`, but 0-based.
11
+ * Random sample of integers from `0..n-1`. Equivalent to R's `sample.int()`. Unlike R, it is 0-based.
12
12
  *
13
13
  * The result is R's `sample.int(n, ...)` minus 1, so it can be used directly as array
14
14
  * indices. It consumes the same random numbers as R (default `sample.kind = "Rejection"`).
@@ -22,6 +22,8 @@ import { isRounding, unifIndex, unifRand } from "./rng.js";
22
22
  * setSeed(42);
23
23
  * sampleInt(10, { size: 3 }); // [0, 4, 9] (R: set.seed(42); sample.int(10, 3) - 1)
24
24
  * ```
25
+ *
26
+ * @category Random numbers
25
27
  */
26
28
  export function sampleInt(n, options = {}) {
27
29
  return sampleInt1(n, options).map((v) => v - 1);
@@ -105,6 +107,8 @@ function sampleInt1(n, options) {
105
107
  * sample(["a", "b", "c", "d", "e"]); // ["a", "e", "d", "c", "b"]
106
108
  * sample([1, 2, 3], { size: 5, replace: true, prob: [0.5, 0.3, 0.2] });
107
109
  * ```
110
+ *
111
+ * @category Random numbers
108
112
  */
109
113
  export function sample(x, options = {}) {
110
114
  return sampleInt1(x.length, options).map((i) => x[i - 1]);
@@ -21,6 +21,8 @@
21
21
  * setRandomSeed(s2);
22
22
  * runif(2); // [0.31369782407981056, 0.9280126525616814]
23
23
  * ```
24
+ *
25
+ * @category Random numbers
24
26
  */
25
27
  export declare function nextRNGStream(state: ArrayLike<number>): Int32Array;
26
28
  /**
@@ -30,5 +32,16 @@ export declare function nextRNGStream(state: ArrayLike<number>): Int32Array;
30
32
  * @param state A 7-integer state, as for {@link nextRNGStream}.
31
33
  * @returns A new state of the same form.
32
34
  * @throws RangeError if `state` is not a valid L'Ecuyer-CMRG state.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * RNGkind({ kind: "L'Ecuyer-CMRG" });
39
+ * setSeed(1);
40
+ * setRandomSeed(nextRNGSubStream(getRandomSeed()));
41
+ * // R: .Random.seed <- parallel::nextRNGSubStream(.Random.seed)
42
+ * runif(2); // [0.9158314, 0.1484848]
43
+ * ```
44
+ *
45
+ * @category Random numbers
33
46
  */
34
47
  export declare function nextRNGSubStream(state: ArrayLike<number>): Int32Array;
@@ -58,6 +58,8 @@ function jump(state, a1, a2) {
58
58
  * setRandomSeed(s2);
59
59
  * runif(2); // [0.31369782407981056, 0.9280126525616814]
60
60
  * ```
61
+ *
62
+ * @category Random numbers
61
63
  */
62
64
  export function nextRNGStream(state) {
63
65
  return jump(state, A1P127, A2P127);
@@ -69,6 +71,17 @@ export function nextRNGStream(state) {
69
71
  * @param state A 7-integer state, as for {@link nextRNGStream}.
70
72
  * @returns A new state of the same form.
71
73
  * @throws RangeError if `state` is not a valid L'Ecuyer-CMRG state.
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * RNGkind({ kind: "L'Ecuyer-CMRG" });
78
+ * setSeed(1);
79
+ * setRandomSeed(nextRNGSubStream(getRandomSeed()));
80
+ * // R: .Random.seed <- parallel::nextRNGSubStream(.Random.seed)
81
+ * runif(2); // [0.9158314, 0.1484848]
82
+ * ```
83
+ *
84
+ * @category Random numbers
72
85
  */
73
86
  export function nextRNGSubStream(state) {
74
87
  return jump(state, A1P76, A2P76);