@elaraai/east-web-std 1.0.85

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 (102) hide show
  1. package/CLA.md +26 -0
  2. package/CONTRIBUTING.md +28 -0
  3. package/LICENSE.md +31 -0
  4. package/README.md +191 -0
  5. package/THIRD_PARTY_NOTICES.md +123 -0
  6. package/dist/src/compliance.spec.d.ts +6 -0
  7. package/dist/src/compliance.spec.d.ts.map +1 -0
  8. package/dist/src/compliance.spec.js +89 -0
  9. package/dist/src/compliance.spec.js.map +1 -0
  10. package/dist/src/console.d.ts +237 -0
  11. package/dist/src/console.d.ts.map +1 -0
  12. package/dist/src/console.js +260 -0
  13. package/dist/src/console.js.map +1 -0
  14. package/dist/src/crypto.d.ts +224 -0
  15. package/dist/src/crypto.d.ts.map +1 -0
  16. package/dist/src/crypto.js +295 -0
  17. package/dist/src/crypto.js.map +1 -0
  18. package/dist/src/fetch.d.ts +383 -0
  19. package/dist/src/fetch.d.ts.map +1 -0
  20. package/dist/src/fetch.js +412 -0
  21. package/dist/src/fetch.js.map +1 -0
  22. package/dist/src/index.d.ts +106 -0
  23. package/dist/src/index.d.ts.map +1 -0
  24. package/dist/src/index.js +93 -0
  25. package/dist/src/index.js.map +1 -0
  26. package/dist/src/path.d.ts +243 -0
  27. package/dist/src/path.d.ts.map +1 -0
  28. package/dist/src/path.js +562 -0
  29. package/dist/src/path.js.map +1 -0
  30. package/dist/src/random/crypto-rng.d.ts +38 -0
  31. package/dist/src/random/crypto-rng.d.ts.map +1 -0
  32. package/dist/src/random/crypto-rng.js +55 -0
  33. package/dist/src/random/crypto-rng.js.map +1 -0
  34. package/dist/src/random/distributions/bates.d.ts +17 -0
  35. package/dist/src/random/distributions/bates.d.ts.map +1 -0
  36. package/dist/src/random/distributions/bates.js +15 -0
  37. package/dist/src/random/distributions/bates.js.map +1 -0
  38. package/dist/src/random/distributions/bernoulli.d.ts +17 -0
  39. package/dist/src/random/distributions/bernoulli.d.ts.map +1 -0
  40. package/dist/src/random/distributions/bernoulli.js +13 -0
  41. package/dist/src/random/distributions/bernoulli.js.map +1 -0
  42. package/dist/src/random/distributions/binomial.d.ts +17 -0
  43. package/dist/src/random/distributions/binomial.d.ts.map +1 -0
  44. package/dist/src/random/distributions/binomial.js +24 -0
  45. package/dist/src/random/distributions/binomial.js.map +1 -0
  46. package/dist/src/random/distributions/exponential.d.ts +17 -0
  47. package/dist/src/random/distributions/exponential.d.ts.map +1 -0
  48. package/dist/src/random/distributions/exponential.js +13 -0
  49. package/dist/src/random/distributions/exponential.js.map +1 -0
  50. package/dist/src/random/distributions/geometric.d.ts +17 -0
  51. package/dist/src/random/distributions/geometric.d.ts.map +1 -0
  52. package/dist/src/random/distributions/geometric.js +14 -0
  53. package/dist/src/random/distributions/geometric.js.map +1 -0
  54. package/dist/src/random/distributions/irwin-hall.d.ts +17 -0
  55. package/dist/src/random/distributions/irwin-hall.d.ts.map +1 -0
  56. package/dist/src/random/distributions/irwin-hall.js +18 -0
  57. package/dist/src/random/distributions/irwin-hall.js.map +1 -0
  58. package/dist/src/random/distributions/log-normal.d.ts +17 -0
  59. package/dist/src/random/distributions/log-normal.d.ts.map +1 -0
  60. package/dist/src/random/distributions/log-normal.js +12 -0
  61. package/dist/src/random/distributions/log-normal.js.map +1 -0
  62. package/dist/src/random/distributions/normal.d.ts +18 -0
  63. package/dist/src/random/distributions/normal.d.ts.map +1 -0
  64. package/dist/src/random/distributions/normal.js +16 -0
  65. package/dist/src/random/distributions/normal.js.map +1 -0
  66. package/dist/src/random/distributions/pareto.d.ts +17 -0
  67. package/dist/src/random/distributions/pareto.d.ts.map +1 -0
  68. package/dist/src/random/distributions/pareto.js +14 -0
  69. package/dist/src/random/distributions/pareto.js.map +1 -0
  70. package/dist/src/random/distributions/poisson.d.ts +17 -0
  71. package/dist/src/random/distributions/poisson.d.ts.map +1 -0
  72. package/dist/src/random/distributions/poisson.js +81 -0
  73. package/dist/src/random/distributions/poisson.js.map +1 -0
  74. package/dist/src/random/distributions/uniform-int.d.ts +17 -0
  75. package/dist/src/random/distributions/uniform-int.d.ts.map +1 -0
  76. package/dist/src/random/distributions/uniform-int.js +16 -0
  77. package/dist/src/random/distributions/uniform-int.js.map +1 -0
  78. package/dist/src/random/distributions/uniform.d.ts +17 -0
  79. package/dist/src/random/distributions/uniform.d.ts.map +1 -0
  80. package/dist/src/random/distributions/uniform.js +10 -0
  81. package/dist/src/random/distributions/uniform.js.map +1 -0
  82. package/dist/src/random/rng.d.ts +21 -0
  83. package/dist/src/random/rng.d.ts.map +1 -0
  84. package/dist/src/random/rng.js +7 -0
  85. package/dist/src/random/rng.js.map +1 -0
  86. package/dist/src/random/xorshift128.d.ts +42 -0
  87. package/dist/src/random/xorshift128.d.ts.map +1 -0
  88. package/dist/src/random/xorshift128.js +119 -0
  89. package/dist/src/random/xorshift128.js.map +1 -0
  90. package/dist/src/random.d.ts +822 -0
  91. package/dist/src/random.d.ts.map +1 -0
  92. package/dist/src/random.js +992 -0
  93. package/dist/src/random.js.map +1 -0
  94. package/dist/src/test.d.ts +86 -0
  95. package/dist/src/test.d.ts.map +1 -0
  96. package/dist/src/test.js +160 -0
  97. package/dist/src/test.js.map +1 -0
  98. package/dist/src/time.d.ts +201 -0
  99. package/dist/src/time.d.ts.map +1 -0
  100. package/dist/src/time.js +300 -0
  101. package/dist/src/time.js.map +1 -0
  102. package/package.json +64 -0
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Vendored from npm package 'random' (https://github.com/transitive-bullshit/random)
7
+ * Originally by Travis Fischer, distributed under MIT license
8
+ *
9
+ * Ported verbatim from east-node-std's src/random/distributions/bates.ts
10
+ * (libs/east-node/packages/east-node-std/src/random/distributions/bates.ts):
11
+ * a seeded stream must stay bit-identical to east-node-std's, which
12
+ * test/random.spec.ts checks.
13
+ */
14
+ import type RNG from "../rng.js";
15
+ declare const _default: (random: RNG, n: bigint) => () => number;
16
+ export default _default;
17
+ //# sourceMappingURL=bates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bates.d.ts","sourceRoot":"","sources":["../../../../src/random/distributions/bates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;yBAGjB,QAAQ,GAAG,EAAE,GAAG,MAAM;AAAtC,wBASE"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ import irwinHallDist from "./irwin-hall.js";
6
+ export default (random, n) => {
7
+ if (!Number.isInteger(Number(n)) || n <= 0n) {
8
+ throw new Error(`Expected n to be a positive integer, got ${n}`);
9
+ }
10
+ const irwinHall = irwinHallDist(random, n);
11
+ return () => {
12
+ return irwinHall() / Number(n);
13
+ };
14
+ };
15
+ //# sourceMappingURL=bates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bates.js","sourceRoot":"","sources":["../../../../src/random/distributions/bates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,eAAe,CAAC,MAAW,EAAE,CAAS,EAAE,EAAE;IACtC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,EAAE,CAAC,CAAC;IACrE,CAAC;IACD,MAAM,SAAS,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAE3C,OAAO,GAAG,EAAE;QACR,OAAO,SAAS,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Vendored from npm package 'random' (https://github.com/transitive-bullshit/random)
7
+ * Originally by Travis Fischer, distributed under MIT license
8
+ *
9
+ * Ported verbatim from east-node-std's src/random/distributions/bernoulli.ts
10
+ * (libs/east-node/packages/east-node-std/src/random/distributions/bernoulli.ts):
11
+ * a seeded stream must stay bit-identical to east-node-std's, which
12
+ * test/random.spec.ts checks.
13
+ */
14
+ import type RNG from "../rng.js";
15
+ declare const _default: (random: RNG, p: number) => () => number;
16
+ export default _default;
17
+ //# sourceMappingURL=bernoulli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bernoulli.d.ts","sourceRoot":"","sources":["../../../../src/random/distributions/bernoulli.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;yBAEjB,QAAQ,GAAG,EAAE,GAAG,MAAM;AAAtC,wBAQE"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ export default (random, p) => {
6
+ if (p < 0 || p >= 1) {
7
+ throw new Error(`Expected p to be in [0, 1), got ${p}`);
8
+ }
9
+ return () => {
10
+ return Math.floor(random.next() + p);
11
+ };
12
+ };
13
+ //# sourceMappingURL=bernoulli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bernoulli.js","sourceRoot":"","sources":["../../../../src/random/distributions/bernoulli.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,eAAe,CAAC,MAAW,EAAE,CAAS,EAAE,EAAE;IACtC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,GAAG,EAAE;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;IACzC,CAAC,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Vendored from npm package 'random' (https://github.com/transitive-bullshit/random)
7
+ * Originally by Travis Fischer, distributed under MIT license
8
+ *
9
+ * Ported verbatim from east-node-std's src/random/distributions/binomial.ts
10
+ * (libs/east-node/packages/east-node-std/src/random/distributions/binomial.ts):
11
+ * a seeded stream must stay bit-identical to east-node-std's, which
12
+ * test/random.spec.ts checks.
13
+ */
14
+ import type RNG from "../rng.js";
15
+ declare const _default: (random: RNG, n: bigint, p: number) => () => number;
16
+ export default _default;
17
+ //# sourceMappingURL=binomial.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binomial.d.ts","sourceRoot":"","sources":["../../../../src/random/distributions/binomial.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;yBAEjB,QAAQ,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM;AAAjD,wBAoBE"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ export default (random, n, p) => {
6
+ if (!Number.isInteger(Number(n)) || n <= 0n) {
7
+ throw new Error(`Expected n to be a positive integer, got ${n}`);
8
+ }
9
+ if (p < 0 || p >= 1) {
10
+ throw new Error(`Expected p to be in [0, 1), got ${p}`);
11
+ }
12
+ return () => {
13
+ let i = 0;
14
+ let x = 0;
15
+ const trials = Number(n);
16
+ while (i++ < trials) {
17
+ if (random.next() < p) {
18
+ x++;
19
+ }
20
+ }
21
+ return x;
22
+ };
23
+ };
24
+ //# sourceMappingURL=binomial.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binomial.js","sourceRoot":"","sources":["../../../../src/random/distributions/binomial.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,eAAe,CAAC,MAAW,EAAE,CAAS,EAAE,CAAS,EAAE,EAAE;IACjD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,EAAE,CAAC,CAAC;IACrE,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,GAAG,EAAE;QACR,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAEzB,OAAO,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC;YAClB,IAAI,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;gBACpB,CAAC,EAAE,CAAC;YACR,CAAC;QACL,CAAC;QACD,OAAO,CAAC,CAAC;IACb,CAAC,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Vendored from npm package 'random' (https://github.com/transitive-bullshit/random)
7
+ * Originally by Travis Fischer, distributed under MIT license
8
+ *
9
+ * Ported verbatim from east-node-std's src/random/distributions/exponential.ts
10
+ * (libs/east-node/packages/east-node-std/src/random/distributions/exponential.ts):
11
+ * a seeded stream must stay bit-identical to east-node-std's, which
12
+ * test/random.spec.ts checks.
13
+ */
14
+ import type RNG from "../rng.js";
15
+ declare const _default: (random: RNG, lambda: number) => () => number;
16
+ export default _default;
17
+ //# sourceMappingURL=exponential.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exponential.d.ts","sourceRoot":"","sources":["../../../../src/random/distributions/exponential.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;yBAEjB,QAAQ,GAAG,EAAE,QAAQ,MAAM;AAA3C,wBAQE"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ export default (random, lambda) => {
6
+ if (lambda <= 0) {
7
+ throw new Error(`Expected lambda to be positive, got ${lambda}`);
8
+ }
9
+ return () => {
10
+ return -Math.log(1 - random.next()) / lambda;
11
+ };
12
+ };
13
+ //# sourceMappingURL=exponential.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exponential.js","sourceRoot":"","sources":["../../../../src/random/distributions/exponential.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,eAAe,CAAC,MAAW,EAAE,MAAc,EAAE,EAAE;IAC3C,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,uCAAuC,MAAM,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,GAAG,EAAE;QACR,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC;IACjD,CAAC,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Vendored from npm package 'random' (https://github.com/transitive-bullshit/random)
7
+ * Originally by Travis Fischer, distributed under MIT license
8
+ *
9
+ * Ported verbatim from east-node-std's src/random/distributions/geometric.ts
10
+ * (libs/east-node/packages/east-node-std/src/random/distributions/geometric.ts):
11
+ * a seeded stream must stay bit-identical to east-node-std's, which
12
+ * test/random.spec.ts checks.
13
+ */
14
+ import type RNG from "../rng.js";
15
+ declare const _default: (random: RNG, p: number) => () => number;
16
+ export default _default;
17
+ //# sourceMappingURL=geometric.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometric.d.ts","sourceRoot":"","sources":["../../../../src/random/distributions/geometric.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;yBAEjB,QAAQ,GAAG,EAAE,GAAG,MAAM;AAAtC,wBASE"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ export default (random, p) => {
6
+ if (p <= 0 || p >= 1) {
7
+ throw new Error(`Expected p to be in (0, 1), got ${p}`);
8
+ }
9
+ const invLogP = 1.0 / Math.log(1.0 - p);
10
+ return () => {
11
+ return Math.floor(1 + Math.log(random.next()) * invLogP);
12
+ };
13
+ };
14
+ //# sourceMappingURL=geometric.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometric.js","sourceRoot":"","sources":["../../../../src/random/distributions/geometric.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,eAAe,CAAC,MAAW,EAAE,CAAS,EAAE,EAAE;IACtC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,MAAM,OAAO,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IAExC,OAAO,GAAG,EAAE;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC;IAC7D,CAAC,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Vendored from npm package 'random' (https://github.com/transitive-bullshit/random)
7
+ * Originally by Travis Fischer, distributed under MIT license
8
+ *
9
+ * Ported verbatim from east-node-std's src/random/distributions/irwin-hall.ts
10
+ * (libs/east-node/packages/east-node-std/src/random/distributions/irwin-hall.ts):
11
+ * a seeded stream must stay bit-identical to east-node-std's, which
12
+ * test/random.spec.ts checks.
13
+ */
14
+ import type RNG from "../rng.js";
15
+ declare const _default: (random: RNG, n: bigint) => () => number;
16
+ export default _default;
17
+ //# sourceMappingURL=irwin-hall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"irwin-hall.d.ts","sourceRoot":"","sources":["../../../../src/random/distributions/irwin-hall.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;yBAEjB,QAAQ,GAAG,EAAE,GAAG,MAAM;AAAtC,wBAcE"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ export default (random, n) => {
6
+ if (!Number.isInteger(Number(n)) || n < 0n) {
7
+ throw new Error(`Expected n to be a non-negative integer, got ${n}`);
8
+ }
9
+ return () => {
10
+ let sum = 0;
11
+ const iterations = Number(n);
12
+ for (let i = 0; i < iterations; ++i) {
13
+ sum += random.next();
14
+ }
15
+ return sum;
16
+ };
17
+ };
18
+ //# sourceMappingURL=irwin-hall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"irwin-hall.js","sourceRoot":"","sources":["../../../../src/random/distributions/irwin-hall.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,eAAe,CAAC,MAAW,EAAE,CAAS,EAAE,EAAE;IACtC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,EAAE,CAAC,CAAC;IACzE,CAAC;IAED,OAAO,GAAG,EAAE;QACR,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,EAAE,CAAC,EAAE,CAAC;YAClC,GAAG,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QACzB,CAAC;QAED,OAAO,GAAG,CAAC;IACf,CAAC,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Vendored from npm package 'random' (https://github.com/transitive-bullshit/random)
7
+ * Originally by Travis Fischer, distributed under MIT license
8
+ *
9
+ * Ported verbatim from east-node-std's src/random/distributions/log-normal.ts
10
+ * (libs/east-node/packages/east-node-std/src/random/distributions/log-normal.ts):
11
+ * a seeded stream must stay bit-identical to east-node-std's, which
12
+ * test/random.spec.ts checks.
13
+ */
14
+ import type RNG from "../rng.js";
15
+ declare const _default: (random: RNG, mu?: number, sigma?: number) => () => number;
16
+ export default _default;
17
+ //# sourceMappingURL=log-normal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-normal.d.ts","sourceRoot":"","sources":["../../../../src/random/distributions/log-normal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;yBAGjB,QAAQ,GAAG,EAAE,WAAM,EAAE,cAAS;AAA9C,wBAKE"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ import normalDist from "./normal.js";
6
+ export default (random, mu = 0, sigma = 1) => {
7
+ const normal = normalDist(random, mu, sigma);
8
+ return () => {
9
+ return Math.exp(normal());
10
+ };
11
+ };
12
+ //# sourceMappingURL=log-normal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-normal.js","sourceRoot":"","sources":["../../../../src/random/distributions/log-normal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,eAAe,CAAC,MAAW,EAAE,EAAE,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,EAAE;IAC9C,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IAC7C,OAAO,GAAG,EAAE;QACR,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9B,CAAC,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Vendored from npm package 'random' (https://github.com/transitive-bullshit/random)
7
+ * Originally by Travis Fischer, distributed under MIT license
8
+ * Uses Marsaglia polar method for generating normal distribution
9
+ *
10
+ * Ported verbatim from east-node-std's src/random/distributions/normal.ts
11
+ * (libs/east-node/packages/east-node-std/src/random/distributions/normal.ts):
12
+ * a seeded stream must stay bit-identical to east-node-std's, which
13
+ * test/random.spec.ts checks.
14
+ */
15
+ import type RNG from "../rng.js";
16
+ declare const _default: (random: RNG, mu?: number, sigma?: number) => () => number;
17
+ export default _default;
18
+ //# sourceMappingURL=normal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normal.d.ts","sourceRoot":"","sources":["../../../../src/random/distributions/normal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;yBAEjB,QAAQ,GAAG,EAAE,WAAM,EAAE,cAAS;AAA9C,wBAYE"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ export default (random, mu = 0, sigma = 1) => {
6
+ return () => {
7
+ let x, y, r;
8
+ do {
9
+ x = random.next() * 2 - 1;
10
+ y = random.next() * 2 - 1;
11
+ r = x * x + y * y;
12
+ } while (!r || r > 1);
13
+ return mu + sigma * y * Math.sqrt((-2 * Math.log(r)) / r);
14
+ };
15
+ };
16
+ //# sourceMappingURL=normal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normal.js","sourceRoot":"","sources":["../../../../src/random/distributions/normal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,eAAe,CAAC,MAAW,EAAE,EAAE,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,EAAE;IAC9C,OAAO,GAAG,EAAE;QACR,IAAI,CAAS,EAAE,CAAS,EAAE,CAAS,CAAC;QAEpC,GAAG,CAAC;YACA,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;YAC1B,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;YAC1B,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACtB,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAEtB,OAAO,EAAE,GAAG,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9D,CAAC,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Vendored from npm package 'random' (https://github.com/transitive-bullshit/random)
7
+ * Originally by Travis Fischer, distributed under MIT license
8
+ *
9
+ * Ported verbatim from east-node-std's src/random/distributions/pareto.ts
10
+ * (libs/east-node/packages/east-node-std/src/random/distributions/pareto.ts):
11
+ * a seeded stream must stay bit-identical to east-node-std's, which
12
+ * test/random.spec.ts checks.
13
+ */
14
+ import type RNG from "../rng.js";
15
+ declare const _default: (random: RNG, alpha: number) => () => number;
16
+ export default _default;
17
+ //# sourceMappingURL=pareto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pareto.d.ts","sourceRoot":"","sources":["../../../../src/random/distributions/pareto.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;yBAEjB,QAAQ,GAAG,EAAE,OAAO,MAAM;AAA1C,wBASE"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ export default (random, alpha) => {
6
+ if (alpha < 0) {
7
+ throw new Error(`Expected alpha to be non-negative, got ${alpha}`);
8
+ }
9
+ const invAlpha = 1.0 / alpha;
10
+ return () => {
11
+ return 1.0 / Math.pow(1.0 - random.next(), invAlpha);
12
+ };
13
+ };
14
+ //# sourceMappingURL=pareto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pareto.js","sourceRoot":"","sources":["../../../../src/random/distributions/pareto.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,eAAe,CAAC,MAAW,EAAE,KAAa,EAAE,EAAE;IAC1C,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,0CAA0C,KAAK,EAAE,CAAC,CAAC;IACvE,CAAC;IACD,MAAM,QAAQ,GAAG,GAAG,GAAG,KAAK,CAAC;IAE7B,OAAO,GAAG,EAAE;QACR,OAAO,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,MAAM,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;IACzD,CAAC,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Vendored from npm package 'random' (https://github.com/transitive-bullshit/random)
7
+ * Originally by Travis Fischer, distributed under MIT license
8
+ *
9
+ * Ported verbatim from east-node-std's src/random/distributions/poisson.ts
10
+ * (libs/east-node/packages/east-node-std/src/random/distributions/poisson.ts):
11
+ * a seeded stream must stay bit-identical to east-node-std's, which
12
+ * test/random.spec.ts checks.
13
+ */
14
+ import type RNG from "../rng.js";
15
+ declare const _default: (random: RNG, lambda: number) => () => number;
16
+ export default _default;
17
+ //# sourceMappingURL=poisson.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poisson.d.ts","sourceRoot":"","sources":["../../../../src/random/distributions/poisson.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;yBAcjB,QAAQ,GAAG,EAAE,QAAQ,MAAM;AAA3C,wBA8EE"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ const logFactorialTable = [
6
+ 0.0, 0.0, 0.69314718055994529, 1.791759469228055, 3.1780538303479458,
7
+ 4.7874917427820458, 6.5792512120101012, 8.5251613610654147,
8
+ 10.604602902745251, 12.801827480081469
9
+ ];
10
+ const logFactorial = (k) => {
11
+ return logFactorialTable[k];
12
+ };
13
+ const logSqrt2PI = 0.91893853320467267;
14
+ export default (random, lambda) => {
15
+ if (lambda <= 0) {
16
+ throw new Error(`Expected lambda to be positive, got ${lambda}`);
17
+ }
18
+ if (lambda < 10) {
19
+ // inversion method
20
+ const expMean = Math.exp(-lambda);
21
+ return () => {
22
+ let p = expMean;
23
+ let x = 0;
24
+ let u = random.next();
25
+ while (u > p) {
26
+ u = u - p;
27
+ p = (lambda * p) / ++x;
28
+ }
29
+ return x;
30
+ };
31
+ }
32
+ else {
33
+ // generative method
34
+ const smu = Math.sqrt(lambda);
35
+ const b = 0.931 + 2.53 * smu;
36
+ const a = -0.059 + 0.02483 * b;
37
+ const invAlpha = 1.1239 + 1.1328 / (b - 3.4);
38
+ const vR = 0.9277 - 3.6224 / (b - 2);
39
+ return () => {
40
+ while (true) {
41
+ let u;
42
+ let v = random.next();
43
+ if (v <= 0.86 * vR) {
44
+ u = v / vR - 0.43;
45
+ return Math.floor(((2 * a) / (0.5 - Math.abs(u)) + b) * u + lambda + 0.445);
46
+ }
47
+ if (v >= vR) {
48
+ u = random.next() - 0.5;
49
+ }
50
+ else {
51
+ u = v / vR - 0.93;
52
+ u = (u < 0 ? -0.5 : 0.5) - u;
53
+ v = random.next() * vR;
54
+ }
55
+ const us = 0.5 - Math.abs(u);
56
+ if (us < 0.013 && v > us) {
57
+ continue;
58
+ }
59
+ const k = Math.floor(((2 * a) / us + b) * u + lambda + 0.445);
60
+ v = (v * invAlpha) / (a / (us * us) + b);
61
+ if (k >= 10) {
62
+ const t = (k + 0.5) * Math.log(lambda / k) -
63
+ lambda -
64
+ logSqrt2PI +
65
+ k -
66
+ (1 / 12.0 - (1 / 360.0 - 1 / (1260.0 * k * k)) / (k * k)) / k;
67
+ if (Math.log(v * smu) <= t) {
68
+ return k;
69
+ }
70
+ }
71
+ else if (k >= 0) {
72
+ const f = logFactorial(k) ?? 0;
73
+ if (Math.log(v) <= k * Math.log(lambda) - lambda - f) {
74
+ return k;
75
+ }
76
+ }
77
+ }
78
+ };
79
+ }
80
+ };
81
+ //# sourceMappingURL=poisson.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poisson.js","sourceRoot":"","sources":["../../../../src/random/distributions/poisson.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Vendored from npm package 'random' (https://github.com/transitive-bullshit/random)
7
+ * Originally by Travis Fischer, distributed under MIT license
8
+ *
9
+ * Ported verbatim from east-node-std's src/random/distributions/uniform-int.ts
10
+ * (libs/east-node/packages/east-node-std/src/random/distributions/uniform-int.ts):
11
+ * a seeded stream must stay bit-identical to east-node-std's, which
12
+ * test/random.spec.ts checks.
13
+ */
14
+ import type RNG from "../rng.js";
15
+ declare const _default: (random: RNG, min: bigint, max: bigint) => () => number;
16
+ export default _default;
17
+ //# sourceMappingURL=uniform-int.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uniform-int.d.ts","sourceRoot":"","sources":["../../../../src/random/distributions/uniform-int.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;yBAEjB,QAAQ,GAAG,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM;AAArD,wBAWE"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ export default (random, min, max) => {
6
+ if (!Number.isInteger(Number(min))) {
7
+ throw new Error(`Expected min to be an integer, got ${min}`);
8
+ }
9
+ if (!Number.isInteger(Number(max))) {
10
+ throw new Error(`Expected max to be an integer, got ${max}`);
11
+ }
12
+ return () => {
13
+ return Math.floor(random.next() * (Number(max) - Number(min) + 1) + Number(min));
14
+ };
15
+ };
16
+ //# sourceMappingURL=uniform-int.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uniform-int.js","sourceRoot":"","sources":["../../../../src/random/distributions/uniform-int.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,eAAe,CAAC,MAAW,EAAE,GAAW,EAAE,GAAW,EAAE,EAAE;IACrD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,sCAAsC,GAAG,EAAE,CAAC,CAAC;IACjE,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,sCAAsC,GAAG,EAAE,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,GAAG,EAAE;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IACrF,CAAC,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Vendored from npm package 'random' (https://github.com/transitive-bullshit/random)
7
+ * Originally by Travis Fischer, distributed under MIT license
8
+ *
9
+ * Ported verbatim from east-node-std's src/random/distributions/uniform.ts
10
+ * (libs/east-node/packages/east-node-std/src/random/distributions/uniform.ts):
11
+ * a seeded stream must stay bit-identical to east-node-std's, which
12
+ * test/random.spec.ts checks.
13
+ */
14
+ import type RNG from "../rng.js";
15
+ declare const _default: (random: RNG, min?: number, max?: number) => () => number;
16
+ export default _default;
17
+ //# sourceMappingURL=uniform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uniform.d.ts","sourceRoot":"","sources":["../../../../src/random/distributions/uniform.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;yBAEjB,QAAQ,GAAG,EAAE,YAAO,EAAE,YAAO;AAA7C,wBAIE"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ export default (random, min = 0, max = 1) => {
6
+ return () => {
7
+ return random.next() * (max - min) + min;
8
+ };
9
+ };
10
+ //# sourceMappingURL=uniform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uniform.js","sourceRoot":"","sources":["../../../../src/random/distributions/uniform.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,eAAe,CAAC,MAAW,EAAE,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,EAAE;IAC7C,OAAO,GAAG,EAAE;QACR,OAAO,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;IAC7C,CAAC,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Vendored from npm package 'random' (https://github.com/transitive-bullshit/random)
7
+ * Originally by Travis Fischer, distributed under MIT license
8
+ *
9
+ * Ported verbatim from east-node-std's src/random/rng.ts
10
+ * (libs/east-node/packages/east-node-std/src/random/rng.ts): a seeded stream
11
+ * must stay bit-identical to east-node-std's, which test/random.spec.ts checks.
12
+ */
13
+ export type SeedFn = () => number;
14
+ export type SeedType = number | bigint | string | SeedFn | RNG;
15
+ export default abstract class RNG {
16
+ abstract get name(): string;
17
+ abstract next(): number;
18
+ abstract seed(_seed?: SeedType, _opts?: Record<string, unknown>): void;
19
+ abstract clone(_seed?: SeedType, _opts?: Record<string, unknown>): RNG;
20
+ }
21
+ //# sourceMappingURL=rng.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rng.d.ts","sourceRoot":"","sources":["../../../src/random/rng.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,MAAM,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC;AAClC,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;AAE/D,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,GAAG;IAC7B,QAAQ,KAAK,IAAI,IAAI,MAAM,CAAC;IAE5B,QAAQ,CAAC,IAAI,IAAI,MAAM;IAEvB,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAEtE,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,GAAG;CACzE"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ export default class RNG {
6
+ }
7
+ //# sourceMappingURL=rng.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rng.js","sourceRoot":"","sources":["../../../src/random/rng.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,MAAM,CAAC,OAAO,OAAgB,GAAG;CAQhC"}