Set up comprehensive frontend testing infrastructure
- Install Jest for unit testing with React Testing Library - Install Playwright for end-to-end testing - Configure Jest with proper TypeScript support and module mapping - Create test setup files and utilities for both unit and e2e tests Components: * Jest configuration with coverage thresholds * Playwright configuration with browser automation * Unit tests for LoginForm, AuthContext, and useSocketIO hook * E2E tests for authentication, dashboard, and agents workflows * GitHub Actions workflow for automated testing * Mock data and API utilities for consistent testing * Test documentation with best practices Testing features: - Unit tests with 70% coverage threshold - E2E tests with API mocking and user journey testing - CI/CD integration for automated test runs - Cross-browser testing support with Playwright - Authentication system testing end-to-end 🚀 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
26
frontend/node_modules/pure-rand/CHANGELOG.md
generated
vendored
Normal file
26
frontend/node_modules/pure-rand/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
# CHANGELOG 7.X
|
||||
|
||||
## 7.0.1
|
||||
|
||||
### Fixes
|
||||
|
||||
- [c24bc93](https://github.com/dubzzz/pure-rand/commit/c24bc93) 🐛 Properly define exports in package.json (#758)
|
||||
|
||||
## 7.0.0
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
- [2c94832](https://github.com/dubzzz/pure-rand/commit/2c94832) 🏷️ Move to "import type" when feasible (#736)
|
||||
- [3741a63](https://github.com/dubzzz/pure-rand/commit/3741a63) 🏷️ Mark `getState` as compulsory on `RandomGenerator` (#733)
|
||||
|
||||
### Features
|
||||
|
||||
- [228c73d](https://github.com/dubzzz/pure-rand/commit/228c73d) ⚡️ Faster uniform distributions on bigint (#757)
|
||||
- [86869a1](https://github.com/dubzzz/pure-rand/commit/86869a1) ✨ Expose generators and distributions (#735)
|
||||
|
||||
### Fixes
|
||||
|
||||
- [680a672](https://github.com/dubzzz/pure-rand/commit/680a672) 🚚 Do not export mersenne as default (#738)
|
||||
- [e1758c0](https://github.com/dubzzz/pure-rand/commit/e1758c0) 🚚 Split ArrayInt into two files (#737)
|
||||
- [0c356cf](https://github.com/dubzzz/pure-rand/commit/0c356cf) 🚚 Moving files around (#734)
|
||||
- [6d9b7b4](https://github.com/dubzzz/pure-rand/commit/6d9b7b4) 📝 Document generation of float/double (#715)
|
||||
21
frontend/node_modules/pure-rand/LICENSE
generated
vendored
Normal file
21
frontend/node_modules/pure-rand/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Nicolas DUBIEN
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
252
frontend/node_modules/pure-rand/README.md
generated
vendored
Normal file
252
frontend/node_modules/pure-rand/README.md
generated
vendored
Normal file
@@ -0,0 +1,252 @@
|
||||
<h1>
|
||||
<img src="https://raw.githubusercontent.com/dubzzz/pure-rand/main/assets/logo.svg" alt="pure-rand logo" />
|
||||
</h1>
|
||||
|
||||
Fast Pseudorandom number generators (aka PRNG) with purity in mind!
|
||||
|
||||
[](https://github.com/dubzzz/pure-rand/actions)
|
||||
[](https://badge.fury.io/js/pure-rand)
|
||||
[](https://www.npmjs.com/package/pure-rand)
|
||||
|
||||
[](https://codecov.io/gh/dubzzz/pure-rand)
|
||||
[](https://packagequality.com/#?package=pure-rand)
|
||||
[](https://snyk.io/advisor/npm-package/pure-rand)
|
||||
[](https://fast-check.dev/)
|
||||
|
||||
[](https://github.com/dubzzz/pure-rand/labels/good%20first%20issue)
|
||||
[](https://github.com/dubzzz/pure-rand/blob/main/LICENSE)
|
||||
[](https://twitter.com/intent/tweet?text=Check%20out%20pure-rand%20by%20%40ndubien%20https%3A%2F%2Fgithub.com%2Fdubzzz%2Fpure-rand%20%F0%9F%91%8D)
|
||||
|
||||
## Getting started
|
||||
|
||||
**Install it in node via:**
|
||||
|
||||
`npm install pure-rand` or `yarn add pure-rand`
|
||||
|
||||
**Use it in browser by doing:**
|
||||
|
||||
`import * as prand from 'https://unpkg.com/pure-rand/lib/esm/pure-rand.js';`
|
||||
|
||||
## Usage
|
||||
|
||||
**Simple usage**
|
||||
|
||||
```javascript
|
||||
import prand from 'pure-rand';
|
||||
|
||||
const seed = 42;
|
||||
const rng = prand.xoroshiro128plus(seed);
|
||||
const firstDiceValue = prand.unsafeUniformIntDistribution(1, 6, rng); // value in {1..6}, here: 2
|
||||
const secondDiceValue = prand.unsafeUniformIntDistribution(1, 6, rng); // value in {1..6}, here: 4
|
||||
const thirdDiceValue = prand.unsafeUniformIntDistribution(1, 6, rng); // value in {1..6}, here: 6
|
||||
```
|
||||
|
||||
**Pure usage**
|
||||
|
||||
Pure means that the instance `rng` will never be altered in-place. It can be called again and again and it will always return the same value. But it will also return the next `rng`. Here is an example showing how the code above can be translated into its pure version:
|
||||
|
||||
```javascript
|
||||
import prand from 'pure-rand';
|
||||
|
||||
const seed = 42;
|
||||
const rng1 = prand.xoroshiro128plus(seed);
|
||||
const [firstDiceValue, rng2] = prand.uniformIntDistribution(1, 6, rng1); // value in {1..6}, here: 2
|
||||
const [secondDiceValue, rng3] = prand.uniformIntDistribution(1, 6, rng2); // value in {1..6}, here: 4
|
||||
const [thirdDiceValue, rng4] = prand.uniformIntDistribution(1, 6, rng3); // value in {1..6}, here: 6
|
||||
|
||||
// You can call: prand.uniformIntDistribution(1, 6, rng1);
|
||||
// over and over it will always give you back the same value along with a new rng (always producing the same values too).
|
||||
```
|
||||
|
||||
**Independent simulations**
|
||||
|
||||
In order to produce independent simulations it can be tempting to instanciate several PRNG based on totally different seeds. While it would produce distinct set of values, the best way to ensure fully unrelated sequences is rather to use jumps. Jump just consists into moving far away from the current position in the generator (eg.: jumping in Xoroshiro 128+ will move you 2<sup>64</sup> generations away from the current one on a generator having a sequence of 2<sup>128</sup> elements).
|
||||
|
||||
```javascript
|
||||
import prand from 'pure-rand';
|
||||
|
||||
const seed = 42;
|
||||
const rngSimulation1 = prand.xoroshiro128plus(seed);
|
||||
const rngSimulation2 = rngSimulation1.jump(); // not in-place, creates a new instance
|
||||
const rngSimulation3 = rngSimulation2.jump(); // not in-place, creates a new instance
|
||||
|
||||
const diceSim1Value = prand.unsafeUniformIntDistribution(1, 6, rngSimulation1); // value in {1..6}, here: 2
|
||||
const diceSim2Value = prand.unsafeUniformIntDistribution(1, 6, rngSimulation2); // value in {1..6}, here: 5
|
||||
const diceSim3Value = prand.unsafeUniformIntDistribution(1, 6, rngSimulation3); // value in {1..6}, here: 6
|
||||
```
|
||||
|
||||
**Non-uniform usage**
|
||||
|
||||
While not recommended as non-uniform distribution implies that one or several values from the range will be more likely than others, it might be tempting for people wanting to maximize the throughput.
|
||||
|
||||
```javascript
|
||||
import prand from 'pure-rand';
|
||||
|
||||
const seed = 42;
|
||||
const rng = prand.xoroshiro128plus(seed);
|
||||
const rand = (min, max) => {
|
||||
const out = (rng.unsafeNext() >>> 0) / 0x100000000;
|
||||
return min + Math.floor(out * (max - min + 1));
|
||||
};
|
||||
const firstDiceValue = rand(1, 6); // value in {1..6}, here: 6
|
||||
```
|
||||
|
||||
**Select your seed**
|
||||
|
||||
While not perfect, here is a rather simple way to generate a seed for your PNRG.
|
||||
|
||||
```javascript
|
||||
const seed = Date.now() ^ (Math.random() * 0x100000000);
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
### Pseudorandom number generators
|
||||
|
||||
In computer science most random number generators<sup>(1)</sup> are [pseudorandom number generators](https://en.wikipedia.org/wiki/Pseudorandom_number_generator) (abbreviated: PRNG). In other words, they are fully deterministic and given the original seed one can rebuild the whole sequence.
|
||||
|
||||
Each PRNG algorithm has to deal with tradeoffs in terms of randomness quality, speed, length of the sequence<sup>(2)</sup>... In other words, it's important to compare relative speed of libraries with that in mind. Indeed, a Mersenne Twister PRNG will not have the same strenghts and weaknesses as a Xoroshiro PRNG, so depending on what you need exactly you might prefer one PRNG over another even if it will be slower.
|
||||
|
||||
4 PRNGs come with pure-rand:
|
||||
|
||||
- `congruential32`: Linear Congruential generator — \[[more](https://en.wikipedia.org/wiki/Linear_congruential_generator)\]
|
||||
- `mersenne`: Mersenne Twister generator — \[[more](https://en.wikipedia.org/wiki/Mersenne_Twister)\]
|
||||
- `xorshift128plus`: Xorshift 128+ generator — \[[more](https://en.wikipedia.org/wiki/Xorshift)\]
|
||||
- `xoroshiro128plus`: Xoroshiro 128+ generator — \[[more](https://en.wikipedia.org/wiki/Xorshift)\]
|
||||
|
||||
Our recommendation is `xoroshiro128plus`. But if you want to use another one, you can replace it by any other PRNG provided by pure-rand in the examples above.
|
||||
|
||||
### Distributions
|
||||
|
||||
Once you are able to generate random values, next step is to scale them into the range you want. Indeed, you probably don't want a floating point value between 0 (included) and 1 (excluded) but rather an integer value between 1 and 6 if you emulate a dice or any other range based on your needs.
|
||||
|
||||
At this point, simple way would be to do `min + floor(random() * (max - min + 1))` but actually it will not generate the values with equal probabilities even if you use the best PRNG in the world to back `random()`. In order to have equal probabilities you need to rely on uniform distributions<sup>(3)</sup> which comes built-in in some PNRG libraries.
|
||||
|
||||
pure-rand provides 3 built-in functions for uniform distributions of values:
|
||||
|
||||
- `uniformIntDistribution(min, max, rng)`
|
||||
- `uniformBigIntDistribution(min, max, rng)` - with `min` and `max` being `bigint`
|
||||
- `uniformArrayIntDistribution(min, max, rng)` - with `min` and `max` being instances of `ArrayInt = {sign, data}` ie. sign either 1 or -1 and data an array of numbers between 0 (included) and 0xffffffff (included)
|
||||
|
||||
And their unsafe equivalents to change the PRNG in-place.
|
||||
|
||||
### Extra helpers
|
||||
|
||||
Some helpers are also provided in order to ease the use of `RandomGenerator` instances:
|
||||
|
||||
- `prand.generateN(rng: RandomGenerator, num: number): [number[], RandomGenerator]`: generates `num` random values using `rng` and return the next `RandomGenerator`
|
||||
- `prand.skipN(rng: RandomGenerator, num: number): RandomGenerator`: skips `num` random values and return the next `RandomGenerator`
|
||||
|
||||
## Comparison
|
||||
|
||||
### Summary
|
||||
|
||||
The chart has been split into three sections:
|
||||
|
||||
- section 1: native `Math.random()`
|
||||
- section 2: without uniform distribution of values
|
||||
- section 3: with uniform distribution of values (not supported by all libraries)
|
||||
|
||||
<img src="https://raw.githubusercontent.com/dubzzz/pure-rand/main/perf/comparison.svg" alt="Comparison against other libraries" />
|
||||
|
||||
### Process
|
||||
|
||||
In order to compare the performance of the libraries, we aked them to shuffle an array containing 1,000,000 items (see [code](https://github.com/dubzzz/pure-rand/blob/556ec331c68091c5d56e9da1266112e8ea222b2e/perf/compare.cjs)).
|
||||
|
||||
We then split the measurements into two sections:
|
||||
|
||||
- one for non-uniform distributions — _known to be slower as it implies re-asking for other values to the PRNG until the produced value fall into the acceptable range of values_
|
||||
- one for uniform distributions
|
||||
|
||||
The recommended setup for pure-rand is to rely on our Xoroshiro128+. It provides a long enough sequence of random values, has built-in support for jump, is really efficient while providing a very good quality of randomness.
|
||||
|
||||
### Performance
|
||||
|
||||
**Non-Uniform**
|
||||
|
||||
| Library | Algorithm | Mean time (ms) | Compared to pure-rand |
|
||||
| ------------------------ | ----------------- | -------------- | --------------------- |
|
||||
| native \(node 16.19.1\) | Xorshift128+ | 33.3 | 1.4x slower |
|
||||
| **pure-rand _@6.0.0_** | **Xoroshiro128+** | **24.5** | **reference** |
|
||||
| pure-rand _@6.0.0_ | Xorshift128+ | 25.0 | similar |
|
||||
| pure-rand _@6.0.0_ | Mersenne Twister | 30.8 | 1.3x slower |
|
||||
| pure-rand _@6.0.0_ | Congruential | 22.6 | 1.1x faster |
|
||||
| seedrandom _@3.0.5_ | Alea | 28.1 | 1.1x slower |
|
||||
| seedrandom _@3.0.5_ | Xorshift128 | 28.8 | 1.2x slower |
|
||||
| seedrandom _@3.0.5_ | Tyche-i | 28.6 | 1.2x slower |
|
||||
| seedrandom _@3.0.5_ | Xorwow | 32.0 | 1.3x slower |
|
||||
| seedrandom _@3.0.5_ | Xor4096 | 32.2 | 1.3x slower |
|
||||
| seedrandom _@3.0.5_ | Xorshift7 | 33.5 | 1.4x slower |
|
||||
| @faker-js/faker _@7.6.0_ | Mersenne Twister | 109.1 | 4.5x slower |
|
||||
| chance _@1.1.10_ | Mersenne Twister | 142.9 | 5.8x slower |
|
||||
|
||||
**Uniform**
|
||||
|
||||
| Library | Algorithm | Mean time (ms) | Compared to pure-rand |
|
||||
| ---------------------- | ----------------- | -------------- | --------------------- |
|
||||
| **pure-rand _@6.0.0_** | **Xoroshiro128+** | **53.5** | **reference** |
|
||||
| pure-rand _@6.0.0_ | Xorshift128+ | 52.2 | similar |
|
||||
| pure-rand _@6.0.0_ | Mersenne Twister | 61.6 | 1.2x slower |
|
||||
| pure-rand _@6.0.0_ | Congruential | 57.6 | 1.1x slower |
|
||||
| random-js @2.1.0 | Mersenne Twister | 119.6 | 2.2x slower |
|
||||
|
||||
> System details:
|
||||
>
|
||||
> - OS: Linux 5.15 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
|
||||
> - CPU: (2) x64 Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz
|
||||
> - Memory: 5.88 GB / 6.78 GB
|
||||
> - Container: Yes
|
||||
> - Node: 16.19.1 - /opt/hostedtoolcache/node/16.19.1/x64/bin/node
|
||||
>
|
||||
> _Executed on default runners provided by GitHub Actions_
|
||||
|
||||
---
|
||||
|
||||
(1) — Not all as there are also [hardware-based random number generator](https://en.wikipedia.org/wiki/Hardware_random_number_generator).
|
||||
|
||||
(2) — How long it takes to reapeat itself?
|
||||
|
||||
(3) — While most users don't really think of it, uniform distribution is key! Without it entries might be biased towards some values and make some others less probable. The naive `rand() % numValues` is a good example of biased version as if `rand()` is uniform in `0, 1, 2` and `numValues` is `2`, the probabilities are: `P(0) = 67%`, `P(1) = 33%` causing `1` to be less probable than `0`
|
||||
|
||||
## Advanced patterns
|
||||
|
||||
### Generate 32-bit floating point numbers
|
||||
|
||||
The following snippet is responsible for generating 32-bit floating point numbers that spread uniformly between 0 (included) and 1 (excluded).
|
||||
|
||||
```js
|
||||
import prand from 'pure-rand';
|
||||
|
||||
function generateFloat32(rng) {
|
||||
const g1 = prand.unsafeUniformIntDistribution(0, (1 << 24) - 1, rng);
|
||||
const value = g1 / (1 << 24);
|
||||
return value;
|
||||
}
|
||||
|
||||
const seed = 42;
|
||||
const rng = prand.xoroshiro128plus(seed);
|
||||
|
||||
const float32Bits1 = generateFloat32(rng);
|
||||
const float32Bits2 = generateFloat32(rng);
|
||||
```
|
||||
|
||||
### Generate 64-bit floating point numbers
|
||||
|
||||
The following snippet is responsible for generating 64-bit floating point numbers that spread uniformly between 0 (included) and 1 (excluded).
|
||||
|
||||
```js
|
||||
import prand from 'pure-rand';
|
||||
|
||||
function generateFloat64(rng) {
|
||||
const g1 = prand.unsafeUniformIntDistribution(0, (1 << 26) - 1, rng);
|
||||
const g2 = prand.unsafeUniformIntDistribution(0, (1 << 27) - 1, rng);
|
||||
const value = (g1 * Math.pow(2, 27) + g2) * Math.pow(2, -53);
|
||||
return value;
|
||||
}
|
||||
|
||||
const seed = 42;
|
||||
const rng = prand.xoroshiro128plus(seed);
|
||||
|
||||
const float64Bits1 = generateFloat64(rng);
|
||||
const float64Bits2 = generateFloat64(rng);
|
||||
```
|
||||
9
frontend/node_modules/pure-rand/lib/distribution/GenerateN.js
generated
vendored
Normal file
9
frontend/node_modules/pure-rand/lib/distribution/GenerateN.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generateN = generateN;
|
||||
var UnsafeGenerateN_1 = require("./UnsafeGenerateN");
|
||||
function generateN(rng, num) {
|
||||
var nextRng = rng.clone();
|
||||
var out = (0, UnsafeGenerateN_1.unsafeGenerateN)(nextRng, num);
|
||||
return [out, nextRng];
|
||||
}
|
||||
9
frontend/node_modules/pure-rand/lib/distribution/SkipN.js
generated
vendored
Normal file
9
frontend/node_modules/pure-rand/lib/distribution/SkipN.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.skipN = skipN;
|
||||
var UnsafeSkipN_1 = require("./UnsafeSkipN");
|
||||
function skipN(rng, num) {
|
||||
var nextRng = rng.clone();
|
||||
(0, UnsafeSkipN_1.unsafeSkipN)(nextRng, num);
|
||||
return nextRng;
|
||||
}
|
||||
14
frontend/node_modules/pure-rand/lib/distribution/UniformArrayIntDistribution.js
generated
vendored
Normal file
14
frontend/node_modules/pure-rand/lib/distribution/UniformArrayIntDistribution.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.uniformArrayIntDistribution = uniformArrayIntDistribution;
|
||||
var UnsafeUniformArrayIntDistribution_1 = require("./UnsafeUniformArrayIntDistribution");
|
||||
function uniformArrayIntDistribution(from, to, rng) {
|
||||
if (rng != null) {
|
||||
var nextRng = rng.clone();
|
||||
return [(0, UnsafeUniformArrayIntDistribution_1.unsafeUniformArrayIntDistribution)(from, to, nextRng), nextRng];
|
||||
}
|
||||
return function (rng) {
|
||||
var nextRng = rng.clone();
|
||||
return [(0, UnsafeUniformArrayIntDistribution_1.unsafeUniformArrayIntDistribution)(from, to, nextRng), nextRng];
|
||||
};
|
||||
}
|
||||
14
frontend/node_modules/pure-rand/lib/distribution/UniformBigIntDistribution.js
generated
vendored
Normal file
14
frontend/node_modules/pure-rand/lib/distribution/UniformBigIntDistribution.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.uniformBigIntDistribution = uniformBigIntDistribution;
|
||||
var UnsafeUniformBigIntDistribution_1 = require("./UnsafeUniformBigIntDistribution");
|
||||
function uniformBigIntDistribution(from, to, rng) {
|
||||
if (rng != null) {
|
||||
var nextRng = rng.clone();
|
||||
return [(0, UnsafeUniformBigIntDistribution_1.unsafeUniformBigIntDistribution)(from, to, nextRng), nextRng];
|
||||
}
|
||||
return function (rng) {
|
||||
var nextRng = rng.clone();
|
||||
return [(0, UnsafeUniformBigIntDistribution_1.unsafeUniformBigIntDistribution)(from, to, nextRng), nextRng];
|
||||
};
|
||||
}
|
||||
14
frontend/node_modules/pure-rand/lib/distribution/UniformIntDistribution.js
generated
vendored
Normal file
14
frontend/node_modules/pure-rand/lib/distribution/UniformIntDistribution.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.uniformIntDistribution = uniformIntDistribution;
|
||||
var UnsafeUniformIntDistribution_1 = require("./UnsafeUniformIntDistribution");
|
||||
function uniformIntDistribution(from, to, rng) {
|
||||
if (rng != null) {
|
||||
var nextRng = rng.clone();
|
||||
return [(0, UnsafeUniformIntDistribution_1.unsafeUniformIntDistribution)(from, to, nextRng), nextRng];
|
||||
}
|
||||
return function (rng) {
|
||||
var nextRng = rng.clone();
|
||||
return [(0, UnsafeUniformIntDistribution_1.unsafeUniformIntDistribution)(from, to, nextRng), nextRng];
|
||||
};
|
||||
}
|
||||
10
frontend/node_modules/pure-rand/lib/distribution/UnsafeGenerateN.js
generated
vendored
Normal file
10
frontend/node_modules/pure-rand/lib/distribution/UnsafeGenerateN.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.unsafeGenerateN = unsafeGenerateN;
|
||||
function unsafeGenerateN(rng, num) {
|
||||
var out = [];
|
||||
for (var idx = 0; idx != num; ++idx) {
|
||||
out.push(rng.unsafeNext());
|
||||
}
|
||||
return out;
|
||||
}
|
||||
8
frontend/node_modules/pure-rand/lib/distribution/UnsafeSkipN.js
generated
vendored
Normal file
8
frontend/node_modules/pure-rand/lib/distribution/UnsafeSkipN.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.unsafeSkipN = unsafeSkipN;
|
||||
function unsafeSkipN(rng, num) {
|
||||
for (var idx = 0; idx != num; ++idx) {
|
||||
rng.unsafeNext();
|
||||
}
|
||||
}
|
||||
11
frontend/node_modules/pure-rand/lib/distribution/UnsafeUniformArrayIntDistribution.js
generated
vendored
Normal file
11
frontend/node_modules/pure-rand/lib/distribution/UnsafeUniformArrayIntDistribution.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.unsafeUniformArrayIntDistribution = unsafeUniformArrayIntDistribution;
|
||||
var ArrayInt_1 = require("./internals/ArrayInt");
|
||||
var UnsafeUniformArrayIntDistributionInternal_1 = require("./internals/UnsafeUniformArrayIntDistributionInternal");
|
||||
function unsafeUniformArrayIntDistribution(from, to, rng) {
|
||||
var rangeSize = (0, ArrayInt_1.trimArrayIntInplace)((0, ArrayInt_1.addOneToPositiveArrayInt)((0, ArrayInt_1.substractArrayIntToNew)(to, from)));
|
||||
var emptyArrayIntData = rangeSize.data.slice(0);
|
||||
var g = (0, UnsafeUniformArrayIntDistributionInternal_1.unsafeUniformArrayIntDistributionInternal)(emptyArrayIntData, rangeSize.data, rng);
|
||||
return (0, ArrayInt_1.trimArrayIntInplace)((0, ArrayInt_1.addArrayIntToNew)({ sign: 1, data: g }, from));
|
||||
}
|
||||
36
frontend/node_modules/pure-rand/lib/distribution/UnsafeUniformBigIntDistribution.js
generated
vendored
Normal file
36
frontend/node_modules/pure-rand/lib/distribution/UnsafeUniformBigIntDistribution.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.unsafeUniformBigIntDistribution = unsafeUniformBigIntDistribution;
|
||||
var SBigInt = typeof BigInt !== 'undefined' ? BigInt : undefined;
|
||||
var One = typeof BigInt !== 'undefined' ? BigInt(1) : undefined;
|
||||
var ThirtyTwo = typeof BigInt !== 'undefined' ? BigInt(32) : undefined;
|
||||
var NumValues = typeof BigInt !== 'undefined' ? BigInt(0x100000000) : undefined;
|
||||
function unsafeUniformBigIntDistribution(from, to, rng) {
|
||||
var diff = to - from + One;
|
||||
var FinalNumValues = NumValues;
|
||||
var NumIterations = 1;
|
||||
while (FinalNumValues < diff) {
|
||||
FinalNumValues <<= ThirtyTwo;
|
||||
++NumIterations;
|
||||
}
|
||||
var value = generateNext(NumIterations, rng);
|
||||
if (value < diff) {
|
||||
return value + from;
|
||||
}
|
||||
if (value + diff < FinalNumValues) {
|
||||
return (value % diff) + from;
|
||||
}
|
||||
var MaxAcceptedRandom = FinalNumValues - (FinalNumValues % diff);
|
||||
while (value >= MaxAcceptedRandom) {
|
||||
value = generateNext(NumIterations, rng);
|
||||
}
|
||||
return (value % diff) + from;
|
||||
}
|
||||
function generateNext(NumIterations, rng) {
|
||||
var value = SBigInt(rng.unsafeNext() + 0x80000000);
|
||||
for (var num = 1; num < NumIterations; ++num) {
|
||||
var out = rng.unsafeNext();
|
||||
value = (value << ThirtyTwo) + SBigInt(out + 0x80000000);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
33
frontend/node_modules/pure-rand/lib/distribution/UnsafeUniformIntDistribution.js
generated
vendored
Normal file
33
frontend/node_modules/pure-rand/lib/distribution/UnsafeUniformIntDistribution.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.unsafeUniformIntDistribution = unsafeUniformIntDistribution;
|
||||
var UnsafeUniformIntDistributionInternal_1 = require("./internals/UnsafeUniformIntDistributionInternal");
|
||||
var ArrayInt64_1 = require("./internals/ArrayInt64");
|
||||
var UnsafeUniformArrayIntDistributionInternal_1 = require("./internals/UnsafeUniformArrayIntDistributionInternal");
|
||||
var safeNumberMaxSafeInteger = Number.MAX_SAFE_INTEGER;
|
||||
var sharedA = { sign: 1, data: [0, 0] };
|
||||
var sharedB = { sign: 1, data: [0, 0] };
|
||||
var sharedC = { sign: 1, data: [0, 0] };
|
||||
var sharedData = [0, 0];
|
||||
function uniformLargeIntInternal(from, to, rangeSize, rng) {
|
||||
var rangeSizeArrayIntValue = rangeSize <= safeNumberMaxSafeInteger
|
||||
? (0, ArrayInt64_1.fromNumberToArrayInt64)(sharedC, rangeSize)
|
||||
: (0, ArrayInt64_1.substractArrayInt64)(sharedC, (0, ArrayInt64_1.fromNumberToArrayInt64)(sharedA, to), (0, ArrayInt64_1.fromNumberToArrayInt64)(sharedB, from));
|
||||
if (rangeSizeArrayIntValue.data[1] === 0xffffffff) {
|
||||
rangeSizeArrayIntValue.data[0] += 1;
|
||||
rangeSizeArrayIntValue.data[1] = 0;
|
||||
}
|
||||
else {
|
||||
rangeSizeArrayIntValue.data[1] += 1;
|
||||
}
|
||||
(0, UnsafeUniformArrayIntDistributionInternal_1.unsafeUniformArrayIntDistributionInternal)(sharedData, rangeSizeArrayIntValue.data, rng);
|
||||
return sharedData[0] * 0x100000000 + sharedData[1] + from;
|
||||
}
|
||||
function unsafeUniformIntDistribution(from, to, rng) {
|
||||
var rangeSize = to - from;
|
||||
if (rangeSize <= 0xffffffff) {
|
||||
var g = (0, UnsafeUniformIntDistributionInternal_1.unsafeUniformIntDistributionInternal)(rangeSize + 1, rng);
|
||||
return g + from;
|
||||
}
|
||||
return uniformLargeIntInternal(from, to, rangeSize, rng);
|
||||
}
|
||||
89
frontend/node_modules/pure-rand/lib/distribution/internals/ArrayInt.js
generated
vendored
Normal file
89
frontend/node_modules/pure-rand/lib/distribution/internals/ArrayInt.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.addArrayIntToNew = addArrayIntToNew;
|
||||
exports.addOneToPositiveArrayInt = addOneToPositiveArrayInt;
|
||||
exports.substractArrayIntToNew = substractArrayIntToNew;
|
||||
exports.trimArrayIntInplace = trimArrayIntInplace;
|
||||
function addArrayIntToNew(arrayIntA, arrayIntB) {
|
||||
if (arrayIntA.sign !== arrayIntB.sign) {
|
||||
return substractArrayIntToNew(arrayIntA, { sign: -arrayIntB.sign, data: arrayIntB.data });
|
||||
}
|
||||
var data = [];
|
||||
var reminder = 0;
|
||||
var dataA = arrayIntA.data;
|
||||
var dataB = arrayIntB.data;
|
||||
for (var indexA = dataA.length - 1, indexB = dataB.length - 1; indexA >= 0 || indexB >= 0; --indexA, --indexB) {
|
||||
var vA = indexA >= 0 ? dataA[indexA] : 0;
|
||||
var vB = indexB >= 0 ? dataB[indexB] : 0;
|
||||
var current = vA + vB + reminder;
|
||||
data.push(current >>> 0);
|
||||
reminder = ~~(current / 0x100000000);
|
||||
}
|
||||
if (reminder !== 0) {
|
||||
data.push(reminder);
|
||||
}
|
||||
return { sign: arrayIntA.sign, data: data.reverse() };
|
||||
}
|
||||
function addOneToPositiveArrayInt(arrayInt) {
|
||||
arrayInt.sign = 1;
|
||||
var data = arrayInt.data;
|
||||
for (var index = data.length - 1; index >= 0; --index) {
|
||||
if (data[index] === 0xffffffff) {
|
||||
data[index] = 0;
|
||||
}
|
||||
else {
|
||||
data[index] += 1;
|
||||
return arrayInt;
|
||||
}
|
||||
}
|
||||
data.unshift(1);
|
||||
return arrayInt;
|
||||
}
|
||||
function isStrictlySmaller(dataA, dataB) {
|
||||
var maxLength = Math.max(dataA.length, dataB.length);
|
||||
for (var index = 0; index < maxLength; ++index) {
|
||||
var indexA = index + dataA.length - maxLength;
|
||||
var indexB = index + dataB.length - maxLength;
|
||||
var vA = indexA >= 0 ? dataA[indexA] : 0;
|
||||
var vB = indexB >= 0 ? dataB[indexB] : 0;
|
||||
if (vA < vB)
|
||||
return true;
|
||||
if (vA > vB)
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function substractArrayIntToNew(arrayIntA, arrayIntB) {
|
||||
if (arrayIntA.sign !== arrayIntB.sign) {
|
||||
return addArrayIntToNew(arrayIntA, { sign: -arrayIntB.sign, data: arrayIntB.data });
|
||||
}
|
||||
var dataA = arrayIntA.data;
|
||||
var dataB = arrayIntB.data;
|
||||
if (isStrictlySmaller(dataA, dataB)) {
|
||||
var out = substractArrayIntToNew(arrayIntB, arrayIntA);
|
||||
out.sign = -out.sign;
|
||||
return out;
|
||||
}
|
||||
var data = [];
|
||||
var reminder = 0;
|
||||
for (var indexA = dataA.length - 1, indexB = dataB.length - 1; indexA >= 0 || indexB >= 0; --indexA, --indexB) {
|
||||
var vA = indexA >= 0 ? dataA[indexA] : 0;
|
||||
var vB = indexB >= 0 ? dataB[indexB] : 0;
|
||||
var current = vA - vB - reminder;
|
||||
data.push(current >>> 0);
|
||||
reminder = current < 0 ? 1 : 0;
|
||||
}
|
||||
return { sign: arrayIntA.sign, data: data.reverse() };
|
||||
}
|
||||
function trimArrayIntInplace(arrayInt) {
|
||||
var data = arrayInt.data;
|
||||
var firstNonZero = 0;
|
||||
for (; firstNonZero !== data.length && data[firstNonZero] === 0; ++firstNonZero) { }
|
||||
if (firstNonZero === data.length) {
|
||||
arrayInt.sign = 1;
|
||||
arrayInt.data = [0];
|
||||
return arrayInt;
|
||||
}
|
||||
data.splice(0, firstNonZero);
|
||||
return arrayInt;
|
||||
}
|
||||
53
frontend/node_modules/pure-rand/lib/distribution/internals/ArrayInt64.js
generated
vendored
Normal file
53
frontend/node_modules/pure-rand/lib/distribution/internals/ArrayInt64.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fromNumberToArrayInt64 = fromNumberToArrayInt64;
|
||||
exports.substractArrayInt64 = substractArrayInt64;
|
||||
function fromNumberToArrayInt64(out, n) {
|
||||
if (n < 0) {
|
||||
var posN = -n;
|
||||
out.sign = -1;
|
||||
out.data[0] = ~~(posN / 0x100000000);
|
||||
out.data[1] = posN >>> 0;
|
||||
}
|
||||
else {
|
||||
out.sign = 1;
|
||||
out.data[0] = ~~(n / 0x100000000);
|
||||
out.data[1] = n >>> 0;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
function substractArrayInt64(out, arrayIntA, arrayIntB) {
|
||||
var lowA = arrayIntA.data[1];
|
||||
var highA = arrayIntA.data[0];
|
||||
var signA = arrayIntA.sign;
|
||||
var lowB = arrayIntB.data[1];
|
||||
var highB = arrayIntB.data[0];
|
||||
var signB = arrayIntB.sign;
|
||||
out.sign = 1;
|
||||
if (signA === 1 && signB === -1) {
|
||||
var low_1 = lowA + lowB;
|
||||
var high = highA + highB + (low_1 > 0xffffffff ? 1 : 0);
|
||||
out.data[0] = high >>> 0;
|
||||
out.data[1] = low_1 >>> 0;
|
||||
return out;
|
||||
}
|
||||
var lowFirst = lowA;
|
||||
var highFirst = highA;
|
||||
var lowSecond = lowB;
|
||||
var highSecond = highB;
|
||||
if (signA === -1) {
|
||||
lowFirst = lowB;
|
||||
highFirst = highB;
|
||||
lowSecond = lowA;
|
||||
highSecond = highA;
|
||||
}
|
||||
var reminderLow = 0;
|
||||
var low = lowFirst - lowSecond;
|
||||
if (low < 0) {
|
||||
reminderLow = 1;
|
||||
low = low >>> 0;
|
||||
}
|
||||
out.data[0] = highFirst - highSecond - reminderLow;
|
||||
out.data[1] = low;
|
||||
return out;
|
||||
}
|
||||
24
frontend/node_modules/pure-rand/lib/distribution/internals/UnsafeUniformArrayIntDistributionInternal.js
generated
vendored
Normal file
24
frontend/node_modules/pure-rand/lib/distribution/internals/UnsafeUniformArrayIntDistributionInternal.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.unsafeUniformArrayIntDistributionInternal = unsafeUniformArrayIntDistributionInternal;
|
||||
var UnsafeUniformIntDistributionInternal_1 = require("./UnsafeUniformIntDistributionInternal");
|
||||
function unsafeUniformArrayIntDistributionInternal(out, rangeSize, rng) {
|
||||
var rangeLength = rangeSize.length;
|
||||
while (true) {
|
||||
for (var index = 0; index !== rangeLength; ++index) {
|
||||
var indexRangeSize = index === 0 ? rangeSize[0] + 1 : 0x100000000;
|
||||
var g = (0, UnsafeUniformIntDistributionInternal_1.unsafeUniformIntDistributionInternal)(indexRangeSize, rng);
|
||||
out[index] = g;
|
||||
}
|
||||
for (var index = 0; index !== rangeLength; ++index) {
|
||||
var current = out[index];
|
||||
var currentInRange = rangeSize[index];
|
||||
if (current < currentInRange) {
|
||||
return out;
|
||||
}
|
||||
else if (current > currentInRange) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
frontend/node_modules/pure-rand/lib/distribution/internals/UnsafeUniformIntDistributionInternal.js
generated
vendored
Normal file
11
frontend/node_modules/pure-rand/lib/distribution/internals/UnsafeUniformIntDistributionInternal.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.unsafeUniformIntDistributionInternal = unsafeUniformIntDistributionInternal;
|
||||
function unsafeUniformIntDistributionInternal(rangeSize, rng) {
|
||||
var MaxAllowed = rangeSize > 2 ? ~~(0x100000000 / rangeSize) * rangeSize : 0x100000000;
|
||||
var deltaV = rng.unsafeNext() + 0x80000000;
|
||||
while (deltaV >= MaxAllowed) {
|
||||
deltaV = rng.unsafeNext() + 0x80000000;
|
||||
}
|
||||
return deltaV % rangeSize;
|
||||
}
|
||||
6
frontend/node_modules/pure-rand/lib/esm/distribution/GenerateN.js
generated
vendored
Normal file
6
frontend/node_modules/pure-rand/lib/esm/distribution/GenerateN.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { unsafeGenerateN } from './UnsafeGenerateN.js';
|
||||
export function generateN(rng, num) {
|
||||
var nextRng = rng.clone();
|
||||
var out = unsafeGenerateN(nextRng, num);
|
||||
return [out, nextRng];
|
||||
}
|
||||
6
frontend/node_modules/pure-rand/lib/esm/distribution/SkipN.js
generated
vendored
Normal file
6
frontend/node_modules/pure-rand/lib/esm/distribution/SkipN.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { unsafeSkipN } from './UnsafeSkipN.js';
|
||||
export function skipN(rng, num) {
|
||||
var nextRng = rng.clone();
|
||||
unsafeSkipN(nextRng, num);
|
||||
return nextRng;
|
||||
}
|
||||
12
frontend/node_modules/pure-rand/lib/esm/distribution/UniformArrayIntDistribution.js
generated
vendored
Normal file
12
frontend/node_modules/pure-rand/lib/esm/distribution/UniformArrayIntDistribution.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { unsafeUniformArrayIntDistribution } from './UnsafeUniformArrayIntDistribution.js';
|
||||
function uniformArrayIntDistribution(from, to, rng) {
|
||||
if (rng != null) {
|
||||
var nextRng = rng.clone();
|
||||
return [unsafeUniformArrayIntDistribution(from, to, nextRng), nextRng];
|
||||
}
|
||||
return function (rng) {
|
||||
var nextRng = rng.clone();
|
||||
return [unsafeUniformArrayIntDistribution(from, to, nextRng), nextRng];
|
||||
};
|
||||
}
|
||||
export { uniformArrayIntDistribution };
|
||||
12
frontend/node_modules/pure-rand/lib/esm/distribution/UniformBigIntDistribution.js
generated
vendored
Normal file
12
frontend/node_modules/pure-rand/lib/esm/distribution/UniformBigIntDistribution.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { unsafeUniformBigIntDistribution } from './UnsafeUniformBigIntDistribution.js';
|
||||
function uniformBigIntDistribution(from, to, rng) {
|
||||
if (rng != null) {
|
||||
var nextRng = rng.clone();
|
||||
return [unsafeUniformBigIntDistribution(from, to, nextRng), nextRng];
|
||||
}
|
||||
return function (rng) {
|
||||
var nextRng = rng.clone();
|
||||
return [unsafeUniformBigIntDistribution(from, to, nextRng), nextRng];
|
||||
};
|
||||
}
|
||||
export { uniformBigIntDistribution };
|
||||
12
frontend/node_modules/pure-rand/lib/esm/distribution/UniformIntDistribution.js
generated
vendored
Normal file
12
frontend/node_modules/pure-rand/lib/esm/distribution/UniformIntDistribution.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { unsafeUniformIntDistribution } from './UnsafeUniformIntDistribution.js';
|
||||
function uniformIntDistribution(from, to, rng) {
|
||||
if (rng != null) {
|
||||
var nextRng = rng.clone();
|
||||
return [unsafeUniformIntDistribution(from, to, nextRng), nextRng];
|
||||
}
|
||||
return function (rng) {
|
||||
var nextRng = rng.clone();
|
||||
return [unsafeUniformIntDistribution(from, to, nextRng), nextRng];
|
||||
};
|
||||
}
|
||||
export { uniformIntDistribution };
|
||||
7
frontend/node_modules/pure-rand/lib/esm/distribution/UnsafeGenerateN.js
generated
vendored
Normal file
7
frontend/node_modules/pure-rand/lib/esm/distribution/UnsafeGenerateN.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export function unsafeGenerateN(rng, num) {
|
||||
var out = [];
|
||||
for (var idx = 0; idx != num; ++idx) {
|
||||
out.push(rng.unsafeNext());
|
||||
}
|
||||
return out;
|
||||
}
|
||||
5
frontend/node_modules/pure-rand/lib/esm/distribution/UnsafeSkipN.js
generated
vendored
Normal file
5
frontend/node_modules/pure-rand/lib/esm/distribution/UnsafeSkipN.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export function unsafeSkipN(rng, num) {
|
||||
for (var idx = 0; idx != num; ++idx) {
|
||||
rng.unsafeNext();
|
||||
}
|
||||
}
|
||||
8
frontend/node_modules/pure-rand/lib/esm/distribution/UnsafeUniformArrayIntDistribution.js
generated
vendored
Normal file
8
frontend/node_modules/pure-rand/lib/esm/distribution/UnsafeUniformArrayIntDistribution.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { addArrayIntToNew, addOneToPositiveArrayInt, substractArrayIntToNew, trimArrayIntInplace, } from './internals/ArrayInt.js';
|
||||
import { unsafeUniformArrayIntDistributionInternal } from './internals/UnsafeUniformArrayIntDistributionInternal.js';
|
||||
export function unsafeUniformArrayIntDistribution(from, to, rng) {
|
||||
var rangeSize = trimArrayIntInplace(addOneToPositiveArrayInt(substractArrayIntToNew(to, from)));
|
||||
var emptyArrayIntData = rangeSize.data.slice(0);
|
||||
var g = unsafeUniformArrayIntDistributionInternal(emptyArrayIntData, rangeSize.data, rng);
|
||||
return trimArrayIntInplace(addArrayIntToNew({ sign: 1, data: g }, from));
|
||||
}
|
||||
33
frontend/node_modules/pure-rand/lib/esm/distribution/UnsafeUniformBigIntDistribution.js
generated
vendored
Normal file
33
frontend/node_modules/pure-rand/lib/esm/distribution/UnsafeUniformBigIntDistribution.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
var SBigInt = typeof BigInt !== 'undefined' ? BigInt : undefined;
|
||||
var One = typeof BigInt !== 'undefined' ? BigInt(1) : undefined;
|
||||
var ThirtyTwo = typeof BigInt !== 'undefined' ? BigInt(32) : undefined;
|
||||
var NumValues = typeof BigInt !== 'undefined' ? BigInt(0x100000000) : undefined;
|
||||
export function unsafeUniformBigIntDistribution(from, to, rng) {
|
||||
var diff = to - from + One;
|
||||
var FinalNumValues = NumValues;
|
||||
var NumIterations = 1;
|
||||
while (FinalNumValues < diff) {
|
||||
FinalNumValues <<= ThirtyTwo;
|
||||
++NumIterations;
|
||||
}
|
||||
var value = generateNext(NumIterations, rng);
|
||||
if (value < diff) {
|
||||
return value + from;
|
||||
}
|
||||
if (value + diff < FinalNumValues) {
|
||||
return (value % diff) + from;
|
||||
}
|
||||
var MaxAcceptedRandom = FinalNumValues - (FinalNumValues % diff);
|
||||
while (value >= MaxAcceptedRandom) {
|
||||
value = generateNext(NumIterations, rng);
|
||||
}
|
||||
return (value % diff) + from;
|
||||
}
|
||||
function generateNext(NumIterations, rng) {
|
||||
var value = SBigInt(rng.unsafeNext() + 0x80000000);
|
||||
for (var num = 1; num < NumIterations; ++num) {
|
||||
var out = rng.unsafeNext();
|
||||
value = (value << ThirtyTwo) + SBigInt(out + 0x80000000);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
30
frontend/node_modules/pure-rand/lib/esm/distribution/UnsafeUniformIntDistribution.js
generated
vendored
Normal file
30
frontend/node_modules/pure-rand/lib/esm/distribution/UnsafeUniformIntDistribution.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import { unsafeUniformIntDistributionInternal } from './internals/UnsafeUniformIntDistributionInternal.js';
|
||||
import { fromNumberToArrayInt64, substractArrayInt64 } from './internals/ArrayInt64.js';
|
||||
import { unsafeUniformArrayIntDistributionInternal } from './internals/UnsafeUniformArrayIntDistributionInternal.js';
|
||||
var safeNumberMaxSafeInteger = Number.MAX_SAFE_INTEGER;
|
||||
var sharedA = { sign: 1, data: [0, 0] };
|
||||
var sharedB = { sign: 1, data: [0, 0] };
|
||||
var sharedC = { sign: 1, data: [0, 0] };
|
||||
var sharedData = [0, 0];
|
||||
function uniformLargeIntInternal(from, to, rangeSize, rng) {
|
||||
var rangeSizeArrayIntValue = rangeSize <= safeNumberMaxSafeInteger
|
||||
? fromNumberToArrayInt64(sharedC, rangeSize)
|
||||
: substractArrayInt64(sharedC, fromNumberToArrayInt64(sharedA, to), fromNumberToArrayInt64(sharedB, from));
|
||||
if (rangeSizeArrayIntValue.data[1] === 0xffffffff) {
|
||||
rangeSizeArrayIntValue.data[0] += 1;
|
||||
rangeSizeArrayIntValue.data[1] = 0;
|
||||
}
|
||||
else {
|
||||
rangeSizeArrayIntValue.data[1] += 1;
|
||||
}
|
||||
unsafeUniformArrayIntDistributionInternal(sharedData, rangeSizeArrayIntValue.data, rng);
|
||||
return sharedData[0] * 0x100000000 + sharedData[1] + from;
|
||||
}
|
||||
export function unsafeUniformIntDistribution(from, to, rng) {
|
||||
var rangeSize = to - from;
|
||||
if (rangeSize <= 0xffffffff) {
|
||||
var g = unsafeUniformIntDistributionInternal(rangeSize + 1, rng);
|
||||
return g + from;
|
||||
}
|
||||
return uniformLargeIntInternal(from, to, rangeSize, rng);
|
||||
}
|
||||
83
frontend/node_modules/pure-rand/lib/esm/distribution/internals/ArrayInt.js
generated
vendored
Normal file
83
frontend/node_modules/pure-rand/lib/esm/distribution/internals/ArrayInt.js
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
export function addArrayIntToNew(arrayIntA, arrayIntB) {
|
||||
if (arrayIntA.sign !== arrayIntB.sign) {
|
||||
return substractArrayIntToNew(arrayIntA, { sign: -arrayIntB.sign, data: arrayIntB.data });
|
||||
}
|
||||
var data = [];
|
||||
var reminder = 0;
|
||||
var dataA = arrayIntA.data;
|
||||
var dataB = arrayIntB.data;
|
||||
for (var indexA = dataA.length - 1, indexB = dataB.length - 1; indexA >= 0 || indexB >= 0; --indexA, --indexB) {
|
||||
var vA = indexA >= 0 ? dataA[indexA] : 0;
|
||||
var vB = indexB >= 0 ? dataB[indexB] : 0;
|
||||
var current = vA + vB + reminder;
|
||||
data.push(current >>> 0);
|
||||
reminder = ~~(current / 0x100000000);
|
||||
}
|
||||
if (reminder !== 0) {
|
||||
data.push(reminder);
|
||||
}
|
||||
return { sign: arrayIntA.sign, data: data.reverse() };
|
||||
}
|
||||
export function addOneToPositiveArrayInt(arrayInt) {
|
||||
arrayInt.sign = 1;
|
||||
var data = arrayInt.data;
|
||||
for (var index = data.length - 1; index >= 0; --index) {
|
||||
if (data[index] === 0xffffffff) {
|
||||
data[index] = 0;
|
||||
}
|
||||
else {
|
||||
data[index] += 1;
|
||||
return arrayInt;
|
||||
}
|
||||
}
|
||||
data.unshift(1);
|
||||
return arrayInt;
|
||||
}
|
||||
function isStrictlySmaller(dataA, dataB) {
|
||||
var maxLength = Math.max(dataA.length, dataB.length);
|
||||
for (var index = 0; index < maxLength; ++index) {
|
||||
var indexA = index + dataA.length - maxLength;
|
||||
var indexB = index + dataB.length - maxLength;
|
||||
var vA = indexA >= 0 ? dataA[indexA] : 0;
|
||||
var vB = indexB >= 0 ? dataB[indexB] : 0;
|
||||
if (vA < vB)
|
||||
return true;
|
||||
if (vA > vB)
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
export function substractArrayIntToNew(arrayIntA, arrayIntB) {
|
||||
if (arrayIntA.sign !== arrayIntB.sign) {
|
||||
return addArrayIntToNew(arrayIntA, { sign: -arrayIntB.sign, data: arrayIntB.data });
|
||||
}
|
||||
var dataA = arrayIntA.data;
|
||||
var dataB = arrayIntB.data;
|
||||
if (isStrictlySmaller(dataA, dataB)) {
|
||||
var out = substractArrayIntToNew(arrayIntB, arrayIntA);
|
||||
out.sign = -out.sign;
|
||||
return out;
|
||||
}
|
||||
var data = [];
|
||||
var reminder = 0;
|
||||
for (var indexA = dataA.length - 1, indexB = dataB.length - 1; indexA >= 0 || indexB >= 0; --indexA, --indexB) {
|
||||
var vA = indexA >= 0 ? dataA[indexA] : 0;
|
||||
var vB = indexB >= 0 ? dataB[indexB] : 0;
|
||||
var current = vA - vB - reminder;
|
||||
data.push(current >>> 0);
|
||||
reminder = current < 0 ? 1 : 0;
|
||||
}
|
||||
return { sign: arrayIntA.sign, data: data.reverse() };
|
||||
}
|
||||
export function trimArrayIntInplace(arrayInt) {
|
||||
var data = arrayInt.data;
|
||||
var firstNonZero = 0;
|
||||
for (; firstNonZero !== data.length && data[firstNonZero] === 0; ++firstNonZero) { }
|
||||
if (firstNonZero === data.length) {
|
||||
arrayInt.sign = 1;
|
||||
arrayInt.data = [0];
|
||||
return arrayInt;
|
||||
}
|
||||
data.splice(0, firstNonZero);
|
||||
return arrayInt;
|
||||
}
|
||||
49
frontend/node_modules/pure-rand/lib/esm/distribution/internals/ArrayInt64.js
generated
vendored
Normal file
49
frontend/node_modules/pure-rand/lib/esm/distribution/internals/ArrayInt64.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
export function fromNumberToArrayInt64(out, n) {
|
||||
if (n < 0) {
|
||||
var posN = -n;
|
||||
out.sign = -1;
|
||||
out.data[0] = ~~(posN / 0x100000000);
|
||||
out.data[1] = posN >>> 0;
|
||||
}
|
||||
else {
|
||||
out.sign = 1;
|
||||
out.data[0] = ~~(n / 0x100000000);
|
||||
out.data[1] = n >>> 0;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
export function substractArrayInt64(out, arrayIntA, arrayIntB) {
|
||||
var lowA = arrayIntA.data[1];
|
||||
var highA = arrayIntA.data[0];
|
||||
var signA = arrayIntA.sign;
|
||||
var lowB = arrayIntB.data[1];
|
||||
var highB = arrayIntB.data[0];
|
||||
var signB = arrayIntB.sign;
|
||||
out.sign = 1;
|
||||
if (signA === 1 && signB === -1) {
|
||||
var low_1 = lowA + lowB;
|
||||
var high = highA + highB + (low_1 > 0xffffffff ? 1 : 0);
|
||||
out.data[0] = high >>> 0;
|
||||
out.data[1] = low_1 >>> 0;
|
||||
return out;
|
||||
}
|
||||
var lowFirst = lowA;
|
||||
var highFirst = highA;
|
||||
var lowSecond = lowB;
|
||||
var highSecond = highB;
|
||||
if (signA === -1) {
|
||||
lowFirst = lowB;
|
||||
highFirst = highB;
|
||||
lowSecond = lowA;
|
||||
highSecond = highA;
|
||||
}
|
||||
var reminderLow = 0;
|
||||
var low = lowFirst - lowSecond;
|
||||
if (low < 0) {
|
||||
reminderLow = 1;
|
||||
low = low >>> 0;
|
||||
}
|
||||
out.data[0] = highFirst - highSecond - reminderLow;
|
||||
out.data[1] = low;
|
||||
return out;
|
||||
}
|
||||
21
frontend/node_modules/pure-rand/lib/esm/distribution/internals/UnsafeUniformArrayIntDistributionInternal.js
generated
vendored
Normal file
21
frontend/node_modules/pure-rand/lib/esm/distribution/internals/UnsafeUniformArrayIntDistributionInternal.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import { unsafeUniformIntDistributionInternal } from './UnsafeUniformIntDistributionInternal.js';
|
||||
export function unsafeUniformArrayIntDistributionInternal(out, rangeSize, rng) {
|
||||
var rangeLength = rangeSize.length;
|
||||
while (true) {
|
||||
for (var index = 0; index !== rangeLength; ++index) {
|
||||
var indexRangeSize = index === 0 ? rangeSize[0] + 1 : 0x100000000;
|
||||
var g = unsafeUniformIntDistributionInternal(indexRangeSize, rng);
|
||||
out[index] = g;
|
||||
}
|
||||
for (var index = 0; index !== rangeLength; ++index) {
|
||||
var current = out[index];
|
||||
var currentInRange = rangeSize[index];
|
||||
if (current < currentInRange) {
|
||||
return out;
|
||||
}
|
||||
else if (current > currentInRange) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
8
frontend/node_modules/pure-rand/lib/esm/distribution/internals/UnsafeUniformIntDistributionInternal.js
generated
vendored
Normal file
8
frontend/node_modules/pure-rand/lib/esm/distribution/internals/UnsafeUniformIntDistributionInternal.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export function unsafeUniformIntDistributionInternal(rangeSize, rng) {
|
||||
var MaxAllowed = rangeSize > 2 ? ~~(0x100000000 / rangeSize) * rangeSize : 0x100000000;
|
||||
var deltaV = rng.unsafeNext() + 0x80000000;
|
||||
while (deltaV >= MaxAllowed) {
|
||||
deltaV = rng.unsafeNext() + 0x80000000;
|
||||
}
|
||||
return deltaV % rangeSize;
|
||||
}
|
||||
47
frontend/node_modules/pure-rand/lib/esm/generator/LinearCongruential.js
generated
vendored
Normal file
47
frontend/node_modules/pure-rand/lib/esm/generator/LinearCongruential.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
var MULTIPLIER = 0x000343fd;
|
||||
var INCREMENT = 0x00269ec3;
|
||||
var MASK = 0xffffffff;
|
||||
var MASK_2 = (1 << 31) - 1;
|
||||
var computeNextSeed = function (seed) {
|
||||
return (seed * MULTIPLIER + INCREMENT) & MASK;
|
||||
};
|
||||
var computeValueFromNextSeed = function (nextseed) {
|
||||
return (nextseed & MASK_2) >> 16;
|
||||
};
|
||||
var LinearCongruential32 = (function () {
|
||||
function LinearCongruential32(seed) {
|
||||
this.seed = seed;
|
||||
}
|
||||
LinearCongruential32.prototype.clone = function () {
|
||||
return new LinearCongruential32(this.seed);
|
||||
};
|
||||
LinearCongruential32.prototype.next = function () {
|
||||
var nextRng = new LinearCongruential32(this.seed);
|
||||
var out = nextRng.unsafeNext();
|
||||
return [out, nextRng];
|
||||
};
|
||||
LinearCongruential32.prototype.unsafeNext = function () {
|
||||
var s1 = computeNextSeed(this.seed);
|
||||
var v1 = computeValueFromNextSeed(s1);
|
||||
var s2 = computeNextSeed(s1);
|
||||
var v2 = computeValueFromNextSeed(s2);
|
||||
this.seed = computeNextSeed(s2);
|
||||
var v3 = computeValueFromNextSeed(this.seed);
|
||||
var vnext = v3 + ((v2 + (v1 << 15)) << 15);
|
||||
return vnext | 0;
|
||||
};
|
||||
LinearCongruential32.prototype.getState = function () {
|
||||
return [this.seed];
|
||||
};
|
||||
return LinearCongruential32;
|
||||
}());
|
||||
function fromState(state) {
|
||||
var valid = state.length === 1;
|
||||
if (!valid) {
|
||||
throw new Error('The state must have been produced by a congruential32 RandomGenerator');
|
||||
}
|
||||
return new LinearCongruential32(state[0]);
|
||||
}
|
||||
export var congruential32 = Object.assign(function (seed) {
|
||||
return new LinearCongruential32(seed);
|
||||
}, { fromState: fromState });
|
||||
107
frontend/node_modules/pure-rand/lib/esm/generator/MersenneTwister.js
generated
vendored
Normal file
107
frontend/node_modules/pure-rand/lib/esm/generator/MersenneTwister.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
ar[i] = from[i];
|
||||
}
|
||||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
};
|
||||
var MersenneTwister = (function () {
|
||||
function MersenneTwister(states, index) {
|
||||
this.states = states;
|
||||
this.index = index;
|
||||
}
|
||||
MersenneTwister.twist = function (prev) {
|
||||
var mt = prev.slice();
|
||||
for (var idx = 0; idx !== MersenneTwister.N - MersenneTwister.M; ++idx) {
|
||||
var y_1 = (mt[idx] & MersenneTwister.MASK_UPPER) + (mt[idx + 1] & MersenneTwister.MASK_LOWER);
|
||||
mt[idx] = mt[idx + MersenneTwister.M] ^ (y_1 >>> 1) ^ (-(y_1 & 1) & MersenneTwister.A);
|
||||
}
|
||||
for (var idx = MersenneTwister.N - MersenneTwister.M; idx !== MersenneTwister.N - 1; ++idx) {
|
||||
var y_2 = (mt[idx] & MersenneTwister.MASK_UPPER) + (mt[idx + 1] & MersenneTwister.MASK_LOWER);
|
||||
mt[idx] = mt[idx + MersenneTwister.M - MersenneTwister.N] ^ (y_2 >>> 1) ^ (-(y_2 & 1) & MersenneTwister.A);
|
||||
}
|
||||
var y = (mt[MersenneTwister.N - 1] & MersenneTwister.MASK_UPPER) + (mt[0] & MersenneTwister.MASK_LOWER);
|
||||
mt[MersenneTwister.N - 1] = mt[MersenneTwister.M - 1] ^ (y >>> 1) ^ (-(y & 1) & MersenneTwister.A);
|
||||
return mt;
|
||||
};
|
||||
MersenneTwister.seeded = function (seed) {
|
||||
var out = Array(MersenneTwister.N);
|
||||
out[0] = seed;
|
||||
for (var idx = 1; idx !== MersenneTwister.N; ++idx) {
|
||||
var xored = out[idx - 1] ^ (out[idx - 1] >>> 30);
|
||||
out[idx] = (Math.imul(MersenneTwister.F, xored) + idx) | 0;
|
||||
}
|
||||
return out;
|
||||
};
|
||||
MersenneTwister.from = function (seed) {
|
||||
return new MersenneTwister(MersenneTwister.twist(MersenneTwister.seeded(seed)), 0);
|
||||
};
|
||||
MersenneTwister.prototype.clone = function () {
|
||||
return new MersenneTwister(this.states, this.index);
|
||||
};
|
||||
MersenneTwister.prototype.next = function () {
|
||||
var nextRng = new MersenneTwister(this.states, this.index);
|
||||
var out = nextRng.unsafeNext();
|
||||
return [out, nextRng];
|
||||
};
|
||||
MersenneTwister.prototype.unsafeNext = function () {
|
||||
var y = this.states[this.index];
|
||||
y ^= this.states[this.index] >>> MersenneTwister.U;
|
||||
y ^= (y << MersenneTwister.S) & MersenneTwister.B;
|
||||
y ^= (y << MersenneTwister.T) & MersenneTwister.C;
|
||||
y ^= y >>> MersenneTwister.L;
|
||||
if (++this.index >= MersenneTwister.N) {
|
||||
this.states = MersenneTwister.twist(this.states);
|
||||
this.index = 0;
|
||||
}
|
||||
return y;
|
||||
};
|
||||
MersenneTwister.prototype.getState = function () {
|
||||
return __spreadArray([this.index], __read(this.states), false);
|
||||
};
|
||||
MersenneTwister.fromState = function (state) {
|
||||
var valid = state.length === MersenneTwister.N + 1 && state[0] >= 0 && state[0] < MersenneTwister.N;
|
||||
if (!valid) {
|
||||
throw new Error('The state must have been produced by a mersenne RandomGenerator');
|
||||
}
|
||||
return new MersenneTwister(state.slice(1), state[0]);
|
||||
};
|
||||
MersenneTwister.N = 624;
|
||||
MersenneTwister.M = 397;
|
||||
MersenneTwister.R = 31;
|
||||
MersenneTwister.A = 0x9908b0df;
|
||||
MersenneTwister.F = 1812433253;
|
||||
MersenneTwister.U = 11;
|
||||
MersenneTwister.S = 7;
|
||||
MersenneTwister.B = 0x9d2c5680;
|
||||
MersenneTwister.T = 15;
|
||||
MersenneTwister.C = 0xefc60000;
|
||||
MersenneTwister.L = 18;
|
||||
MersenneTwister.MASK_LOWER = Math.pow(2, MersenneTwister.R) - 1;
|
||||
MersenneTwister.MASK_UPPER = Math.pow(2, MersenneTwister.R);
|
||||
return MersenneTwister;
|
||||
}());
|
||||
function fromState(state) {
|
||||
return MersenneTwister.fromState(state);
|
||||
}
|
||||
export var mersenne = Object.assign(function (seed) {
|
||||
return MersenneTwister.from(seed);
|
||||
}, { fromState: fromState });
|
||||
69
frontend/node_modules/pure-rand/lib/esm/generator/XorShift.js
generated
vendored
Normal file
69
frontend/node_modules/pure-rand/lib/esm/generator/XorShift.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
var XorShift128Plus = (function () {
|
||||
function XorShift128Plus(s01, s00, s11, s10) {
|
||||
this.s01 = s01;
|
||||
this.s00 = s00;
|
||||
this.s11 = s11;
|
||||
this.s10 = s10;
|
||||
}
|
||||
XorShift128Plus.prototype.clone = function () {
|
||||
return new XorShift128Plus(this.s01, this.s00, this.s11, this.s10);
|
||||
};
|
||||
XorShift128Plus.prototype.next = function () {
|
||||
var nextRng = new XorShift128Plus(this.s01, this.s00, this.s11, this.s10);
|
||||
var out = nextRng.unsafeNext();
|
||||
return [out, nextRng];
|
||||
};
|
||||
XorShift128Plus.prototype.unsafeNext = function () {
|
||||
var a0 = this.s00 ^ (this.s00 << 23);
|
||||
var a1 = this.s01 ^ ((this.s01 << 23) | (this.s00 >>> 9));
|
||||
var b0 = a0 ^ this.s10 ^ ((a0 >>> 18) | (a1 << 14)) ^ ((this.s10 >>> 5) | (this.s11 << 27));
|
||||
var b1 = a1 ^ this.s11 ^ (a1 >>> 18) ^ (this.s11 >>> 5);
|
||||
var out = (this.s00 + this.s10) | 0;
|
||||
this.s01 = this.s11;
|
||||
this.s00 = this.s10;
|
||||
this.s11 = b1;
|
||||
this.s10 = b0;
|
||||
return out;
|
||||
};
|
||||
XorShift128Plus.prototype.jump = function () {
|
||||
var nextRng = new XorShift128Plus(this.s01, this.s00, this.s11, this.s10);
|
||||
nextRng.unsafeJump();
|
||||
return nextRng;
|
||||
};
|
||||
XorShift128Plus.prototype.unsafeJump = function () {
|
||||
var ns01 = 0;
|
||||
var ns00 = 0;
|
||||
var ns11 = 0;
|
||||
var ns10 = 0;
|
||||
var jump = [0x635d2dff, 0x8a5cd789, 0x5c472f96, 0x121fd215];
|
||||
for (var i = 0; i !== 4; ++i) {
|
||||
for (var mask = 1; mask; mask <<= 1) {
|
||||
if (jump[i] & mask) {
|
||||
ns01 ^= this.s01;
|
||||
ns00 ^= this.s00;
|
||||
ns11 ^= this.s11;
|
||||
ns10 ^= this.s10;
|
||||
}
|
||||
this.unsafeNext();
|
||||
}
|
||||
}
|
||||
this.s01 = ns01;
|
||||
this.s00 = ns00;
|
||||
this.s11 = ns11;
|
||||
this.s10 = ns10;
|
||||
};
|
||||
XorShift128Plus.prototype.getState = function () {
|
||||
return [this.s01, this.s00, this.s11, this.s10];
|
||||
};
|
||||
return XorShift128Plus;
|
||||
}());
|
||||
function fromState(state) {
|
||||
var valid = state.length === 4;
|
||||
if (!valid) {
|
||||
throw new Error('The state must have been produced by a xorshift128plus RandomGenerator');
|
||||
}
|
||||
return new XorShift128Plus(state[0], state[1], state[2], state[3]);
|
||||
}
|
||||
export var xorshift128plus = Object.assign(function (seed) {
|
||||
return new XorShift128Plus(-1, ~seed, seed | 0, 0);
|
||||
}, { fromState: fromState });
|
||||
69
frontend/node_modules/pure-rand/lib/esm/generator/XoroShiro.js
generated
vendored
Normal file
69
frontend/node_modules/pure-rand/lib/esm/generator/XoroShiro.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
var XoroShiro128Plus = (function () {
|
||||
function XoroShiro128Plus(s01, s00, s11, s10) {
|
||||
this.s01 = s01;
|
||||
this.s00 = s00;
|
||||
this.s11 = s11;
|
||||
this.s10 = s10;
|
||||
}
|
||||
XoroShiro128Plus.prototype.clone = function () {
|
||||
return new XoroShiro128Plus(this.s01, this.s00, this.s11, this.s10);
|
||||
};
|
||||
XoroShiro128Plus.prototype.next = function () {
|
||||
var nextRng = new XoroShiro128Plus(this.s01, this.s00, this.s11, this.s10);
|
||||
var out = nextRng.unsafeNext();
|
||||
return [out, nextRng];
|
||||
};
|
||||
XoroShiro128Plus.prototype.unsafeNext = function () {
|
||||
var out = (this.s00 + this.s10) | 0;
|
||||
var a0 = this.s10 ^ this.s00;
|
||||
var a1 = this.s11 ^ this.s01;
|
||||
var s00 = this.s00;
|
||||
var s01 = this.s01;
|
||||
this.s00 = (s00 << 24) ^ (s01 >>> 8) ^ a0 ^ (a0 << 16);
|
||||
this.s01 = (s01 << 24) ^ (s00 >>> 8) ^ a1 ^ ((a1 << 16) | (a0 >>> 16));
|
||||
this.s10 = (a1 << 5) ^ (a0 >>> 27);
|
||||
this.s11 = (a0 << 5) ^ (a1 >>> 27);
|
||||
return out;
|
||||
};
|
||||
XoroShiro128Plus.prototype.jump = function () {
|
||||
var nextRng = new XoroShiro128Plus(this.s01, this.s00, this.s11, this.s10);
|
||||
nextRng.unsafeJump();
|
||||
return nextRng;
|
||||
};
|
||||
XoroShiro128Plus.prototype.unsafeJump = function () {
|
||||
var ns01 = 0;
|
||||
var ns00 = 0;
|
||||
var ns11 = 0;
|
||||
var ns10 = 0;
|
||||
var jump = [0xd8f554a5, 0xdf900294, 0x4b3201fc, 0x170865df];
|
||||
for (var i = 0; i !== 4; ++i) {
|
||||
for (var mask = 1; mask; mask <<= 1) {
|
||||
if (jump[i] & mask) {
|
||||
ns01 ^= this.s01;
|
||||
ns00 ^= this.s00;
|
||||
ns11 ^= this.s11;
|
||||
ns10 ^= this.s10;
|
||||
}
|
||||
this.unsafeNext();
|
||||
}
|
||||
}
|
||||
this.s01 = ns01;
|
||||
this.s00 = ns00;
|
||||
this.s11 = ns11;
|
||||
this.s10 = ns10;
|
||||
};
|
||||
XoroShiro128Plus.prototype.getState = function () {
|
||||
return [this.s01, this.s00, this.s11, this.s10];
|
||||
};
|
||||
return XoroShiro128Plus;
|
||||
}());
|
||||
function fromState(state) {
|
||||
var valid = state.length === 4;
|
||||
if (!valid) {
|
||||
throw new Error('The state must have been produced by a xoroshiro128plus RandomGenerator');
|
||||
}
|
||||
return new XoroShiro128Plus(state[0], state[1], state[2], state[3]);
|
||||
}
|
||||
export var xoroshiro128plus = Object.assign(function (seed) {
|
||||
return new XoroShiro128Plus(-1, ~seed, seed | 0, 0);
|
||||
}, { fromState: fromState });
|
||||
3
frontend/node_modules/pure-rand/lib/esm/package.json
generated
vendored
Normal file
3
frontend/node_modules/pure-rand/lib/esm/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
18
frontend/node_modules/pure-rand/lib/esm/pure-rand-default.js
generated
vendored
Normal file
18
frontend/node_modules/pure-rand/lib/esm/pure-rand-default.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { congruential32 } from './generator/LinearCongruential.js';
|
||||
import { mersenne } from './generator/MersenneTwister.js';
|
||||
import { xorshift128plus } from './generator/XorShift.js';
|
||||
import { xoroshiro128plus } from './generator/XoroShiro.js';
|
||||
import { uniformArrayIntDistribution } from './distribution/UniformArrayIntDistribution.js';
|
||||
import { uniformBigIntDistribution } from './distribution/UniformBigIntDistribution.js';
|
||||
import { uniformIntDistribution } from './distribution/UniformIntDistribution.js';
|
||||
import { unsafeUniformArrayIntDistribution } from './distribution/UnsafeUniformArrayIntDistribution.js';
|
||||
import { unsafeUniformBigIntDistribution } from './distribution/UnsafeUniformBigIntDistribution.js';
|
||||
import { unsafeUniformIntDistribution } from './distribution/UnsafeUniformIntDistribution.js';
|
||||
import { skipN } from './distribution/SkipN.js';
|
||||
import { generateN } from './distribution/GenerateN.js';
|
||||
import { unsafeGenerateN } from './distribution/UnsafeGenerateN.js';
|
||||
import { unsafeSkipN } from './distribution/UnsafeSkipN.js';
|
||||
var __type = 'module';
|
||||
var __version = '7.0.1';
|
||||
var __commitHash = '2248506b66d969d1a8b477a4dde8e24cbac33e6a';
|
||||
export { __type, __version, __commitHash, generateN, skipN, unsafeGenerateN, unsafeSkipN, congruential32, mersenne, xorshift128plus, xoroshiro128plus, uniformArrayIntDistribution, uniformBigIntDistribution, uniformIntDistribution, unsafeUniformArrayIntDistribution, unsafeUniformBigIntDistribution, unsafeUniformIntDistribution, };
|
||||
3
frontend/node_modules/pure-rand/lib/esm/pure-rand.js
generated
vendored
Normal file
3
frontend/node_modules/pure-rand/lib/esm/pure-rand.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import * as prand from './pure-rand-default.js';
|
||||
export default prand;
|
||||
export * from './pure-rand-default.js';
|
||||
1
frontend/node_modules/pure-rand/lib/esm/types/Distribution.js
generated
vendored
Normal file
1
frontend/node_modules/pure-rand/lib/esm/types/Distribution.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
frontend/node_modules/pure-rand/lib/esm/types/RandomGenerator.js
generated
vendored
Normal file
1
frontend/node_modules/pure-rand/lib/esm/types/RandomGenerator.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
2
frontend/node_modules/pure-rand/lib/esm/types/distribution/GenerateN.d.ts
generated
vendored
Normal file
2
frontend/node_modules/pure-rand/lib/esm/types/distribution/GenerateN.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
export declare function generateN(rng: RandomGenerator, num: number): [number[], RandomGenerator];
|
||||
2
frontend/node_modules/pure-rand/lib/esm/types/distribution/SkipN.d.ts
generated
vendored
Normal file
2
frontend/node_modules/pure-rand/lib/esm/types/distribution/SkipN.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
export declare function skipN(rng: RandomGenerator, num: number): RandomGenerator;
|
||||
6
frontend/node_modules/pure-rand/lib/esm/types/distribution/UniformArrayIntDistribution.d.ts
generated
vendored
Normal file
6
frontend/node_modules/pure-rand/lib/esm/types/distribution/UniformArrayIntDistribution.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { Distribution } from '../types/Distribution.js';
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
import type { ArrayInt } from './internals/ArrayInt.js';
|
||||
declare function uniformArrayIntDistribution(from: ArrayInt, to: ArrayInt): Distribution<ArrayInt>;
|
||||
declare function uniformArrayIntDistribution(from: ArrayInt, to: ArrayInt, rng: RandomGenerator): [ArrayInt, RandomGenerator];
|
||||
export { uniformArrayIntDistribution };
|
||||
5
frontend/node_modules/pure-rand/lib/esm/types/distribution/UniformBigIntDistribution.d.ts
generated
vendored
Normal file
5
frontend/node_modules/pure-rand/lib/esm/types/distribution/UniformBigIntDistribution.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { Distribution } from '../types/Distribution.js';
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
declare function uniformBigIntDistribution(from: bigint, to: bigint): Distribution<bigint>;
|
||||
declare function uniformBigIntDistribution(from: bigint, to: bigint, rng: RandomGenerator): [bigint, RandomGenerator];
|
||||
export { uniformBigIntDistribution };
|
||||
5
frontend/node_modules/pure-rand/lib/esm/types/distribution/UniformIntDistribution.d.ts
generated
vendored
Normal file
5
frontend/node_modules/pure-rand/lib/esm/types/distribution/UniformIntDistribution.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { Distribution } from '../types/Distribution.js';
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
declare function uniformIntDistribution(from: number, to: number): Distribution<number>;
|
||||
declare function uniformIntDistribution(from: number, to: number, rng: RandomGenerator): [number, RandomGenerator];
|
||||
export { uniformIntDistribution };
|
||||
2
frontend/node_modules/pure-rand/lib/esm/types/distribution/UnsafeGenerateN.d.ts
generated
vendored
Normal file
2
frontend/node_modules/pure-rand/lib/esm/types/distribution/UnsafeGenerateN.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
export declare function unsafeGenerateN(rng: RandomGenerator, num: number): number[];
|
||||
2
frontend/node_modules/pure-rand/lib/esm/types/distribution/UnsafeSkipN.d.ts
generated
vendored
Normal file
2
frontend/node_modules/pure-rand/lib/esm/types/distribution/UnsafeSkipN.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
export declare function unsafeSkipN(rng: RandomGenerator, num: number): void;
|
||||
3
frontend/node_modules/pure-rand/lib/esm/types/distribution/UnsafeUniformArrayIntDistribution.d.ts
generated
vendored
Normal file
3
frontend/node_modules/pure-rand/lib/esm/types/distribution/UnsafeUniformArrayIntDistribution.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
import type { ArrayInt } from './internals/ArrayInt.js';
|
||||
export declare function unsafeUniformArrayIntDistribution(from: ArrayInt, to: ArrayInt, rng: RandomGenerator): ArrayInt;
|
||||
2
frontend/node_modules/pure-rand/lib/esm/types/distribution/UnsafeUniformBigIntDistribution.d.ts
generated
vendored
Normal file
2
frontend/node_modules/pure-rand/lib/esm/types/distribution/UnsafeUniformBigIntDistribution.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
export declare function unsafeUniformBigIntDistribution(from: bigint, to: bigint, rng: RandomGenerator): bigint;
|
||||
2
frontend/node_modules/pure-rand/lib/esm/types/distribution/UnsafeUniformIntDistribution.d.ts
generated
vendored
Normal file
2
frontend/node_modules/pure-rand/lib/esm/types/distribution/UnsafeUniformIntDistribution.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
export declare function unsafeUniformIntDistribution(from: number, to: number, rng: RandomGenerator): number;
|
||||
8
frontend/node_modules/pure-rand/lib/esm/types/distribution/internals/ArrayInt.d.ts
generated
vendored
Normal file
8
frontend/node_modules/pure-rand/lib/esm/types/distribution/internals/ArrayInt.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export type ArrayInt = {
|
||||
sign: -1 | 1;
|
||||
data: number[];
|
||||
};
|
||||
export declare function addArrayIntToNew(arrayIntA: ArrayInt, arrayIntB: ArrayInt): ArrayInt;
|
||||
export declare function addOneToPositiveArrayInt(arrayInt: ArrayInt): ArrayInt;
|
||||
export declare function substractArrayIntToNew(arrayIntA: ArrayInt, arrayIntB: ArrayInt): ArrayInt;
|
||||
export declare function trimArrayIntInplace(arrayInt: ArrayInt): ArrayInt;
|
||||
6
frontend/node_modules/pure-rand/lib/esm/types/distribution/internals/ArrayInt64.d.ts
generated
vendored
Normal file
6
frontend/node_modules/pure-rand/lib/esm/types/distribution/internals/ArrayInt64.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { ArrayInt } from './ArrayInt.js';
|
||||
export type ArrayInt64 = Required<ArrayInt> & {
|
||||
data: [number, number];
|
||||
};
|
||||
export declare function fromNumberToArrayInt64(out: ArrayInt64, n: number): ArrayInt64;
|
||||
export declare function substractArrayInt64(out: ArrayInt64, arrayIntA: ArrayInt64, arrayIntB: ArrayInt64): ArrayInt64;
|
||||
3
frontend/node_modules/pure-rand/lib/esm/types/distribution/internals/UnsafeUniformArrayIntDistributionInternal.d.ts
generated
vendored
Normal file
3
frontend/node_modules/pure-rand/lib/esm/types/distribution/internals/UnsafeUniformArrayIntDistributionInternal.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { RandomGenerator } from '../../types/RandomGenerator.js';
|
||||
import type { ArrayInt } from './ArrayInt.js';
|
||||
export declare function unsafeUniformArrayIntDistributionInternal(out: ArrayInt['data'], rangeSize: ArrayInt['data'], rng: RandomGenerator): ArrayInt['data'];
|
||||
2
frontend/node_modules/pure-rand/lib/esm/types/distribution/internals/UnsafeUniformIntDistributionInternal.d.ts
generated
vendored
Normal file
2
frontend/node_modules/pure-rand/lib/esm/types/distribution/internals/UnsafeUniformIntDistributionInternal.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { RandomGenerator } from '../../types/RandomGenerator.js';
|
||||
export declare function unsafeUniformIntDistributionInternal(rangeSize: number, rng: RandomGenerator): number;
|
||||
6
frontend/node_modules/pure-rand/lib/esm/types/generator/LinearCongruential.d.ts
generated
vendored
Normal file
6
frontend/node_modules/pure-rand/lib/esm/types/generator/LinearCongruential.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
declare function fromState(state: readonly number[]): RandomGenerator;
|
||||
export declare const congruential32: ((seed: number) => RandomGenerator) & {
|
||||
fromState: typeof fromState;
|
||||
};
|
||||
export {};
|
||||
6
frontend/node_modules/pure-rand/lib/esm/types/generator/MersenneTwister.d.ts
generated
vendored
Normal file
6
frontend/node_modules/pure-rand/lib/esm/types/generator/MersenneTwister.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
declare function fromState(state: readonly number[]): RandomGenerator;
|
||||
export declare const mersenne: ((seed: number) => RandomGenerator) & {
|
||||
fromState: typeof fromState;
|
||||
};
|
||||
export {};
|
||||
6
frontend/node_modules/pure-rand/lib/esm/types/generator/XorShift.d.ts
generated
vendored
Normal file
6
frontend/node_modules/pure-rand/lib/esm/types/generator/XorShift.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
declare function fromState(state: readonly number[]): RandomGenerator;
|
||||
export declare const xorshift128plus: ((seed: number) => RandomGenerator) & {
|
||||
fromState: typeof fromState;
|
||||
};
|
||||
export {};
|
||||
6
frontend/node_modules/pure-rand/lib/esm/types/generator/XoroShiro.d.ts
generated
vendored
Normal file
6
frontend/node_modules/pure-rand/lib/esm/types/generator/XoroShiro.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
declare function fromState(state: readonly number[]): RandomGenerator;
|
||||
export declare const xoroshiro128plus: ((seed: number) => RandomGenerator) & {
|
||||
fromState: typeof fromState;
|
||||
};
|
||||
export {};
|
||||
20
frontend/node_modules/pure-rand/lib/esm/types/pure-rand-default.d.ts
generated
vendored
Normal file
20
frontend/node_modules/pure-rand/lib/esm/types/pure-rand-default.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { RandomGenerator } from './types/RandomGenerator.js';
|
||||
import { congruential32 } from './generator/LinearCongruential.js';
|
||||
import { mersenne } from './generator/MersenneTwister.js';
|
||||
import { xorshift128plus } from './generator/XorShift.js';
|
||||
import { xoroshiro128plus } from './generator/XoroShiro.js';
|
||||
import type { Distribution } from './types/Distribution.js';
|
||||
import { uniformArrayIntDistribution } from './distribution/UniformArrayIntDistribution.js';
|
||||
import { uniformBigIntDistribution } from './distribution/UniformBigIntDistribution.js';
|
||||
import { uniformIntDistribution } from './distribution/UniformIntDistribution.js';
|
||||
import { unsafeUniformArrayIntDistribution } from './distribution/UnsafeUniformArrayIntDistribution.js';
|
||||
import { unsafeUniformBigIntDistribution } from './distribution/UnsafeUniformBigIntDistribution.js';
|
||||
import { unsafeUniformIntDistribution } from './distribution/UnsafeUniformIntDistribution.js';
|
||||
import { skipN } from './distribution/SkipN.js';
|
||||
import { generateN } from './distribution/GenerateN.js';
|
||||
import { unsafeGenerateN } from './distribution/UnsafeGenerateN.js';
|
||||
import { unsafeSkipN } from './distribution/UnsafeSkipN.js';
|
||||
declare const __type: string;
|
||||
declare const __version: string;
|
||||
declare const __commitHash: string;
|
||||
export { __type, __version, __commitHash, RandomGenerator, generateN, skipN, unsafeGenerateN, unsafeSkipN, congruential32, mersenne, xorshift128plus, xoroshiro128plus, Distribution, uniformArrayIntDistribution, uniformBigIntDistribution, uniformIntDistribution, unsafeUniformArrayIntDistribution, unsafeUniformBigIntDistribution, unsafeUniformIntDistribution, };
|
||||
3
frontend/node_modules/pure-rand/lib/esm/types/pure-rand.d.ts
generated
vendored
Normal file
3
frontend/node_modules/pure-rand/lib/esm/types/pure-rand.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import * as prand from './pure-rand-default.js';
|
||||
export default prand;
|
||||
export * from './pure-rand-default.js';
|
||||
2
frontend/node_modules/pure-rand/lib/esm/types/types/Distribution.d.ts
generated
vendored
Normal file
2
frontend/node_modules/pure-rand/lib/esm/types/types/Distribution.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { RandomGenerator } from './RandomGenerator.js';
|
||||
export type Distribution<T> = (rng: RandomGenerator) => [T, RandomGenerator];
|
||||
8
frontend/node_modules/pure-rand/lib/esm/types/types/RandomGenerator.d.ts
generated
vendored
Normal file
8
frontend/node_modules/pure-rand/lib/esm/types/types/RandomGenerator.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export interface RandomGenerator {
|
||||
clone(): RandomGenerator;
|
||||
next(): [number, RandomGenerator];
|
||||
jump?(): RandomGenerator;
|
||||
unsafeNext(): number;
|
||||
unsafeJump?(): void;
|
||||
getState(): readonly number[];
|
||||
}
|
||||
50
frontend/node_modules/pure-rand/lib/generator/LinearCongruential.js
generated
vendored
Normal file
50
frontend/node_modules/pure-rand/lib/generator/LinearCongruential.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.congruential32 = void 0;
|
||||
var MULTIPLIER = 0x000343fd;
|
||||
var INCREMENT = 0x00269ec3;
|
||||
var MASK = 0xffffffff;
|
||||
var MASK_2 = (1 << 31) - 1;
|
||||
var computeNextSeed = function (seed) {
|
||||
return (seed * MULTIPLIER + INCREMENT) & MASK;
|
||||
};
|
||||
var computeValueFromNextSeed = function (nextseed) {
|
||||
return (nextseed & MASK_2) >> 16;
|
||||
};
|
||||
var LinearCongruential32 = (function () {
|
||||
function LinearCongruential32(seed) {
|
||||
this.seed = seed;
|
||||
}
|
||||
LinearCongruential32.prototype.clone = function () {
|
||||
return new LinearCongruential32(this.seed);
|
||||
};
|
||||
LinearCongruential32.prototype.next = function () {
|
||||
var nextRng = new LinearCongruential32(this.seed);
|
||||
var out = nextRng.unsafeNext();
|
||||
return [out, nextRng];
|
||||
};
|
||||
LinearCongruential32.prototype.unsafeNext = function () {
|
||||
var s1 = computeNextSeed(this.seed);
|
||||
var v1 = computeValueFromNextSeed(s1);
|
||||
var s2 = computeNextSeed(s1);
|
||||
var v2 = computeValueFromNextSeed(s2);
|
||||
this.seed = computeNextSeed(s2);
|
||||
var v3 = computeValueFromNextSeed(this.seed);
|
||||
var vnext = v3 + ((v2 + (v1 << 15)) << 15);
|
||||
return vnext | 0;
|
||||
};
|
||||
LinearCongruential32.prototype.getState = function () {
|
||||
return [this.seed];
|
||||
};
|
||||
return LinearCongruential32;
|
||||
}());
|
||||
function fromState(state) {
|
||||
var valid = state.length === 1;
|
||||
if (!valid) {
|
||||
throw new Error('The state must have been produced by a congruential32 RandomGenerator');
|
||||
}
|
||||
return new LinearCongruential32(state[0]);
|
||||
}
|
||||
exports.congruential32 = Object.assign(function (seed) {
|
||||
return new LinearCongruential32(seed);
|
||||
}, { fromState: fromState });
|
||||
110
frontend/node_modules/pure-rand/lib/generator/MersenneTwister.js
generated
vendored
Normal file
110
frontend/node_modules/pure-rand/lib/generator/MersenneTwister.js
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
"use strict";
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
ar[i] = from[i];
|
||||
}
|
||||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.mersenne = void 0;
|
||||
var MersenneTwister = (function () {
|
||||
function MersenneTwister(states, index) {
|
||||
this.states = states;
|
||||
this.index = index;
|
||||
}
|
||||
MersenneTwister.twist = function (prev) {
|
||||
var mt = prev.slice();
|
||||
for (var idx = 0; idx !== MersenneTwister.N - MersenneTwister.M; ++idx) {
|
||||
var y_1 = (mt[idx] & MersenneTwister.MASK_UPPER) + (mt[idx + 1] & MersenneTwister.MASK_LOWER);
|
||||
mt[idx] = mt[idx + MersenneTwister.M] ^ (y_1 >>> 1) ^ (-(y_1 & 1) & MersenneTwister.A);
|
||||
}
|
||||
for (var idx = MersenneTwister.N - MersenneTwister.M; idx !== MersenneTwister.N - 1; ++idx) {
|
||||
var y_2 = (mt[idx] & MersenneTwister.MASK_UPPER) + (mt[idx + 1] & MersenneTwister.MASK_LOWER);
|
||||
mt[idx] = mt[idx + MersenneTwister.M - MersenneTwister.N] ^ (y_2 >>> 1) ^ (-(y_2 & 1) & MersenneTwister.A);
|
||||
}
|
||||
var y = (mt[MersenneTwister.N - 1] & MersenneTwister.MASK_UPPER) + (mt[0] & MersenneTwister.MASK_LOWER);
|
||||
mt[MersenneTwister.N - 1] = mt[MersenneTwister.M - 1] ^ (y >>> 1) ^ (-(y & 1) & MersenneTwister.A);
|
||||
return mt;
|
||||
};
|
||||
MersenneTwister.seeded = function (seed) {
|
||||
var out = Array(MersenneTwister.N);
|
||||
out[0] = seed;
|
||||
for (var idx = 1; idx !== MersenneTwister.N; ++idx) {
|
||||
var xored = out[idx - 1] ^ (out[idx - 1] >>> 30);
|
||||
out[idx] = (Math.imul(MersenneTwister.F, xored) + idx) | 0;
|
||||
}
|
||||
return out;
|
||||
};
|
||||
MersenneTwister.from = function (seed) {
|
||||
return new MersenneTwister(MersenneTwister.twist(MersenneTwister.seeded(seed)), 0);
|
||||
};
|
||||
MersenneTwister.prototype.clone = function () {
|
||||
return new MersenneTwister(this.states, this.index);
|
||||
};
|
||||
MersenneTwister.prototype.next = function () {
|
||||
var nextRng = new MersenneTwister(this.states, this.index);
|
||||
var out = nextRng.unsafeNext();
|
||||
return [out, nextRng];
|
||||
};
|
||||
MersenneTwister.prototype.unsafeNext = function () {
|
||||
var y = this.states[this.index];
|
||||
y ^= this.states[this.index] >>> MersenneTwister.U;
|
||||
y ^= (y << MersenneTwister.S) & MersenneTwister.B;
|
||||
y ^= (y << MersenneTwister.T) & MersenneTwister.C;
|
||||
y ^= y >>> MersenneTwister.L;
|
||||
if (++this.index >= MersenneTwister.N) {
|
||||
this.states = MersenneTwister.twist(this.states);
|
||||
this.index = 0;
|
||||
}
|
||||
return y;
|
||||
};
|
||||
MersenneTwister.prototype.getState = function () {
|
||||
return __spreadArray([this.index], __read(this.states), false);
|
||||
};
|
||||
MersenneTwister.fromState = function (state) {
|
||||
var valid = state.length === MersenneTwister.N + 1 && state[0] >= 0 && state[0] < MersenneTwister.N;
|
||||
if (!valid) {
|
||||
throw new Error('The state must have been produced by a mersenne RandomGenerator');
|
||||
}
|
||||
return new MersenneTwister(state.slice(1), state[0]);
|
||||
};
|
||||
MersenneTwister.N = 624;
|
||||
MersenneTwister.M = 397;
|
||||
MersenneTwister.R = 31;
|
||||
MersenneTwister.A = 0x9908b0df;
|
||||
MersenneTwister.F = 1812433253;
|
||||
MersenneTwister.U = 11;
|
||||
MersenneTwister.S = 7;
|
||||
MersenneTwister.B = 0x9d2c5680;
|
||||
MersenneTwister.T = 15;
|
||||
MersenneTwister.C = 0xefc60000;
|
||||
MersenneTwister.L = 18;
|
||||
MersenneTwister.MASK_LOWER = Math.pow(2, MersenneTwister.R) - 1;
|
||||
MersenneTwister.MASK_UPPER = Math.pow(2, MersenneTwister.R);
|
||||
return MersenneTwister;
|
||||
}());
|
||||
function fromState(state) {
|
||||
return MersenneTwister.fromState(state);
|
||||
}
|
||||
exports.mersenne = Object.assign(function (seed) {
|
||||
return MersenneTwister.from(seed);
|
||||
}, { fromState: fromState });
|
||||
72
frontend/node_modules/pure-rand/lib/generator/XorShift.js
generated
vendored
Normal file
72
frontend/node_modules/pure-rand/lib/generator/XorShift.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.xorshift128plus = void 0;
|
||||
var XorShift128Plus = (function () {
|
||||
function XorShift128Plus(s01, s00, s11, s10) {
|
||||
this.s01 = s01;
|
||||
this.s00 = s00;
|
||||
this.s11 = s11;
|
||||
this.s10 = s10;
|
||||
}
|
||||
XorShift128Plus.prototype.clone = function () {
|
||||
return new XorShift128Plus(this.s01, this.s00, this.s11, this.s10);
|
||||
};
|
||||
XorShift128Plus.prototype.next = function () {
|
||||
var nextRng = new XorShift128Plus(this.s01, this.s00, this.s11, this.s10);
|
||||
var out = nextRng.unsafeNext();
|
||||
return [out, nextRng];
|
||||
};
|
||||
XorShift128Plus.prototype.unsafeNext = function () {
|
||||
var a0 = this.s00 ^ (this.s00 << 23);
|
||||
var a1 = this.s01 ^ ((this.s01 << 23) | (this.s00 >>> 9));
|
||||
var b0 = a0 ^ this.s10 ^ ((a0 >>> 18) | (a1 << 14)) ^ ((this.s10 >>> 5) | (this.s11 << 27));
|
||||
var b1 = a1 ^ this.s11 ^ (a1 >>> 18) ^ (this.s11 >>> 5);
|
||||
var out = (this.s00 + this.s10) | 0;
|
||||
this.s01 = this.s11;
|
||||
this.s00 = this.s10;
|
||||
this.s11 = b1;
|
||||
this.s10 = b0;
|
||||
return out;
|
||||
};
|
||||
XorShift128Plus.prototype.jump = function () {
|
||||
var nextRng = new XorShift128Plus(this.s01, this.s00, this.s11, this.s10);
|
||||
nextRng.unsafeJump();
|
||||
return nextRng;
|
||||
};
|
||||
XorShift128Plus.prototype.unsafeJump = function () {
|
||||
var ns01 = 0;
|
||||
var ns00 = 0;
|
||||
var ns11 = 0;
|
||||
var ns10 = 0;
|
||||
var jump = [0x635d2dff, 0x8a5cd789, 0x5c472f96, 0x121fd215];
|
||||
for (var i = 0; i !== 4; ++i) {
|
||||
for (var mask = 1; mask; mask <<= 1) {
|
||||
if (jump[i] & mask) {
|
||||
ns01 ^= this.s01;
|
||||
ns00 ^= this.s00;
|
||||
ns11 ^= this.s11;
|
||||
ns10 ^= this.s10;
|
||||
}
|
||||
this.unsafeNext();
|
||||
}
|
||||
}
|
||||
this.s01 = ns01;
|
||||
this.s00 = ns00;
|
||||
this.s11 = ns11;
|
||||
this.s10 = ns10;
|
||||
};
|
||||
XorShift128Plus.prototype.getState = function () {
|
||||
return [this.s01, this.s00, this.s11, this.s10];
|
||||
};
|
||||
return XorShift128Plus;
|
||||
}());
|
||||
function fromState(state) {
|
||||
var valid = state.length === 4;
|
||||
if (!valid) {
|
||||
throw new Error('The state must have been produced by a xorshift128plus RandomGenerator');
|
||||
}
|
||||
return new XorShift128Plus(state[0], state[1], state[2], state[3]);
|
||||
}
|
||||
exports.xorshift128plus = Object.assign(function (seed) {
|
||||
return new XorShift128Plus(-1, ~seed, seed | 0, 0);
|
||||
}, { fromState: fromState });
|
||||
72
frontend/node_modules/pure-rand/lib/generator/XoroShiro.js
generated
vendored
Normal file
72
frontend/node_modules/pure-rand/lib/generator/XoroShiro.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.xoroshiro128plus = void 0;
|
||||
var XoroShiro128Plus = (function () {
|
||||
function XoroShiro128Plus(s01, s00, s11, s10) {
|
||||
this.s01 = s01;
|
||||
this.s00 = s00;
|
||||
this.s11 = s11;
|
||||
this.s10 = s10;
|
||||
}
|
||||
XoroShiro128Plus.prototype.clone = function () {
|
||||
return new XoroShiro128Plus(this.s01, this.s00, this.s11, this.s10);
|
||||
};
|
||||
XoroShiro128Plus.prototype.next = function () {
|
||||
var nextRng = new XoroShiro128Plus(this.s01, this.s00, this.s11, this.s10);
|
||||
var out = nextRng.unsafeNext();
|
||||
return [out, nextRng];
|
||||
};
|
||||
XoroShiro128Plus.prototype.unsafeNext = function () {
|
||||
var out = (this.s00 + this.s10) | 0;
|
||||
var a0 = this.s10 ^ this.s00;
|
||||
var a1 = this.s11 ^ this.s01;
|
||||
var s00 = this.s00;
|
||||
var s01 = this.s01;
|
||||
this.s00 = (s00 << 24) ^ (s01 >>> 8) ^ a0 ^ (a0 << 16);
|
||||
this.s01 = (s01 << 24) ^ (s00 >>> 8) ^ a1 ^ ((a1 << 16) | (a0 >>> 16));
|
||||
this.s10 = (a1 << 5) ^ (a0 >>> 27);
|
||||
this.s11 = (a0 << 5) ^ (a1 >>> 27);
|
||||
return out;
|
||||
};
|
||||
XoroShiro128Plus.prototype.jump = function () {
|
||||
var nextRng = new XoroShiro128Plus(this.s01, this.s00, this.s11, this.s10);
|
||||
nextRng.unsafeJump();
|
||||
return nextRng;
|
||||
};
|
||||
XoroShiro128Plus.prototype.unsafeJump = function () {
|
||||
var ns01 = 0;
|
||||
var ns00 = 0;
|
||||
var ns11 = 0;
|
||||
var ns10 = 0;
|
||||
var jump = [0xd8f554a5, 0xdf900294, 0x4b3201fc, 0x170865df];
|
||||
for (var i = 0; i !== 4; ++i) {
|
||||
for (var mask = 1; mask; mask <<= 1) {
|
||||
if (jump[i] & mask) {
|
||||
ns01 ^= this.s01;
|
||||
ns00 ^= this.s00;
|
||||
ns11 ^= this.s11;
|
||||
ns10 ^= this.s10;
|
||||
}
|
||||
this.unsafeNext();
|
||||
}
|
||||
}
|
||||
this.s01 = ns01;
|
||||
this.s00 = ns00;
|
||||
this.s11 = ns11;
|
||||
this.s10 = ns10;
|
||||
};
|
||||
XoroShiro128Plus.prototype.getState = function () {
|
||||
return [this.s01, this.s00, this.s11, this.s10];
|
||||
};
|
||||
return XoroShiro128Plus;
|
||||
}());
|
||||
function fromState(state) {
|
||||
var valid = state.length === 4;
|
||||
if (!valid) {
|
||||
throw new Error('The state must have been produced by a xoroshiro128plus RandomGenerator');
|
||||
}
|
||||
return new XoroShiro128Plus(state[0], state[1], state[2], state[3]);
|
||||
}
|
||||
exports.xoroshiro128plus = Object.assign(function (seed) {
|
||||
return new XoroShiro128Plus(-1, ~seed, seed | 0, 0);
|
||||
}, { fromState: fromState });
|
||||
37
frontend/node_modules/pure-rand/lib/pure-rand-default.js
generated
vendored
Normal file
37
frontend/node_modules/pure-rand/lib/pure-rand-default.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.unsafeUniformIntDistribution = exports.unsafeUniformBigIntDistribution = exports.unsafeUniformArrayIntDistribution = exports.uniformIntDistribution = exports.uniformBigIntDistribution = exports.uniformArrayIntDistribution = exports.xoroshiro128plus = exports.xorshift128plus = exports.mersenne = exports.congruential32 = exports.unsafeSkipN = exports.unsafeGenerateN = exports.skipN = exports.generateN = exports.__commitHash = exports.__version = exports.__type = void 0;
|
||||
var LinearCongruential_1 = require("./generator/LinearCongruential");
|
||||
Object.defineProperty(exports, "congruential32", { enumerable: true, get: function () { return LinearCongruential_1.congruential32; } });
|
||||
var MersenneTwister_1 = require("./generator/MersenneTwister");
|
||||
Object.defineProperty(exports, "mersenne", { enumerable: true, get: function () { return MersenneTwister_1.mersenne; } });
|
||||
var XorShift_1 = require("./generator/XorShift");
|
||||
Object.defineProperty(exports, "xorshift128plus", { enumerable: true, get: function () { return XorShift_1.xorshift128plus; } });
|
||||
var XoroShiro_1 = require("./generator/XoroShiro");
|
||||
Object.defineProperty(exports, "xoroshiro128plus", { enumerable: true, get: function () { return XoroShiro_1.xoroshiro128plus; } });
|
||||
var UniformArrayIntDistribution_1 = require("./distribution/UniformArrayIntDistribution");
|
||||
Object.defineProperty(exports, "uniformArrayIntDistribution", { enumerable: true, get: function () { return UniformArrayIntDistribution_1.uniformArrayIntDistribution; } });
|
||||
var UniformBigIntDistribution_1 = require("./distribution/UniformBigIntDistribution");
|
||||
Object.defineProperty(exports, "uniformBigIntDistribution", { enumerable: true, get: function () { return UniformBigIntDistribution_1.uniformBigIntDistribution; } });
|
||||
var UniformIntDistribution_1 = require("./distribution/UniformIntDistribution");
|
||||
Object.defineProperty(exports, "uniformIntDistribution", { enumerable: true, get: function () { return UniformIntDistribution_1.uniformIntDistribution; } });
|
||||
var UnsafeUniformArrayIntDistribution_1 = require("./distribution/UnsafeUniformArrayIntDistribution");
|
||||
Object.defineProperty(exports, "unsafeUniformArrayIntDistribution", { enumerable: true, get: function () { return UnsafeUniformArrayIntDistribution_1.unsafeUniformArrayIntDistribution; } });
|
||||
var UnsafeUniformBigIntDistribution_1 = require("./distribution/UnsafeUniformBigIntDistribution");
|
||||
Object.defineProperty(exports, "unsafeUniformBigIntDistribution", { enumerable: true, get: function () { return UnsafeUniformBigIntDistribution_1.unsafeUniformBigIntDistribution; } });
|
||||
var UnsafeUniformIntDistribution_1 = require("./distribution/UnsafeUniformIntDistribution");
|
||||
Object.defineProperty(exports, "unsafeUniformIntDistribution", { enumerable: true, get: function () { return UnsafeUniformIntDistribution_1.unsafeUniformIntDistribution; } });
|
||||
var SkipN_1 = require("./distribution/SkipN");
|
||||
Object.defineProperty(exports, "skipN", { enumerable: true, get: function () { return SkipN_1.skipN; } });
|
||||
var GenerateN_1 = require("./distribution/GenerateN");
|
||||
Object.defineProperty(exports, "generateN", { enumerable: true, get: function () { return GenerateN_1.generateN; } });
|
||||
var UnsafeGenerateN_1 = require("./distribution/UnsafeGenerateN");
|
||||
Object.defineProperty(exports, "unsafeGenerateN", { enumerable: true, get: function () { return UnsafeGenerateN_1.unsafeGenerateN; } });
|
||||
var UnsafeSkipN_1 = require("./distribution/UnsafeSkipN");
|
||||
Object.defineProperty(exports, "unsafeSkipN", { enumerable: true, get: function () { return UnsafeSkipN_1.unsafeSkipN; } });
|
||||
var __type = 'commonjs';
|
||||
exports.__type = __type;
|
||||
var __version = '7.0.1';
|
||||
exports.__version = __version;
|
||||
var __commitHash = '2248506b66d969d1a8b477a4dde8e24cbac33e6a';
|
||||
exports.__commitHash = __commitHash;
|
||||
19
frontend/node_modules/pure-rand/lib/pure-rand.js
generated
vendored
Normal file
19
frontend/node_modules/pure-rand/lib/pure-rand.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var prand = require("./pure-rand-default");
|
||||
exports.default = prand;
|
||||
__exportStar(require("./pure-rand-default"), exports);
|
||||
2
frontend/node_modules/pure-rand/lib/types/Distribution.js
generated
vendored
Normal file
2
frontend/node_modules/pure-rand/lib/types/Distribution.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
2
frontend/node_modules/pure-rand/lib/types/RandomGenerator.js
generated
vendored
Normal file
2
frontend/node_modules/pure-rand/lib/types/RandomGenerator.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
2
frontend/node_modules/pure-rand/lib/types/distribution/GenerateN.d.ts
generated
vendored
Normal file
2
frontend/node_modules/pure-rand/lib/types/distribution/GenerateN.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
export declare function generateN(rng: RandomGenerator, num: number): [number[], RandomGenerator];
|
||||
2
frontend/node_modules/pure-rand/lib/types/distribution/SkipN.d.ts
generated
vendored
Normal file
2
frontend/node_modules/pure-rand/lib/types/distribution/SkipN.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
export declare function skipN(rng: RandomGenerator, num: number): RandomGenerator;
|
||||
6
frontend/node_modules/pure-rand/lib/types/distribution/UniformArrayIntDistribution.d.ts
generated
vendored
Normal file
6
frontend/node_modules/pure-rand/lib/types/distribution/UniformArrayIntDistribution.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { Distribution } from '../types/Distribution.js';
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
import type { ArrayInt } from './internals/ArrayInt.js';
|
||||
declare function uniformArrayIntDistribution(from: ArrayInt, to: ArrayInt): Distribution<ArrayInt>;
|
||||
declare function uniformArrayIntDistribution(from: ArrayInt, to: ArrayInt, rng: RandomGenerator): [ArrayInt, RandomGenerator];
|
||||
export { uniformArrayIntDistribution };
|
||||
5
frontend/node_modules/pure-rand/lib/types/distribution/UniformBigIntDistribution.d.ts
generated
vendored
Normal file
5
frontend/node_modules/pure-rand/lib/types/distribution/UniformBigIntDistribution.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { Distribution } from '../types/Distribution.js';
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
declare function uniformBigIntDistribution(from: bigint, to: bigint): Distribution<bigint>;
|
||||
declare function uniformBigIntDistribution(from: bigint, to: bigint, rng: RandomGenerator): [bigint, RandomGenerator];
|
||||
export { uniformBigIntDistribution };
|
||||
5
frontend/node_modules/pure-rand/lib/types/distribution/UniformIntDistribution.d.ts
generated
vendored
Normal file
5
frontend/node_modules/pure-rand/lib/types/distribution/UniformIntDistribution.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { Distribution } from '../types/Distribution.js';
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
declare function uniformIntDistribution(from: number, to: number): Distribution<number>;
|
||||
declare function uniformIntDistribution(from: number, to: number, rng: RandomGenerator): [number, RandomGenerator];
|
||||
export { uniformIntDistribution };
|
||||
2
frontend/node_modules/pure-rand/lib/types/distribution/UnsafeGenerateN.d.ts
generated
vendored
Normal file
2
frontend/node_modules/pure-rand/lib/types/distribution/UnsafeGenerateN.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
export declare function unsafeGenerateN(rng: RandomGenerator, num: number): number[];
|
||||
2
frontend/node_modules/pure-rand/lib/types/distribution/UnsafeSkipN.d.ts
generated
vendored
Normal file
2
frontend/node_modules/pure-rand/lib/types/distribution/UnsafeSkipN.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
export declare function unsafeSkipN(rng: RandomGenerator, num: number): void;
|
||||
3
frontend/node_modules/pure-rand/lib/types/distribution/UnsafeUniformArrayIntDistribution.d.ts
generated
vendored
Normal file
3
frontend/node_modules/pure-rand/lib/types/distribution/UnsafeUniformArrayIntDistribution.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
import type { ArrayInt } from './internals/ArrayInt.js';
|
||||
export declare function unsafeUniformArrayIntDistribution(from: ArrayInt, to: ArrayInt, rng: RandomGenerator): ArrayInt;
|
||||
2
frontend/node_modules/pure-rand/lib/types/distribution/UnsafeUniformBigIntDistribution.d.ts
generated
vendored
Normal file
2
frontend/node_modules/pure-rand/lib/types/distribution/UnsafeUniformBigIntDistribution.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
export declare function unsafeUniformBigIntDistribution(from: bigint, to: bigint, rng: RandomGenerator): bigint;
|
||||
2
frontend/node_modules/pure-rand/lib/types/distribution/UnsafeUniformIntDistribution.d.ts
generated
vendored
Normal file
2
frontend/node_modules/pure-rand/lib/types/distribution/UnsafeUniformIntDistribution.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
export declare function unsafeUniformIntDistribution(from: number, to: number, rng: RandomGenerator): number;
|
||||
8
frontend/node_modules/pure-rand/lib/types/distribution/internals/ArrayInt.d.ts
generated
vendored
Normal file
8
frontend/node_modules/pure-rand/lib/types/distribution/internals/ArrayInt.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export type ArrayInt = {
|
||||
sign: -1 | 1;
|
||||
data: number[];
|
||||
};
|
||||
export declare function addArrayIntToNew(arrayIntA: ArrayInt, arrayIntB: ArrayInt): ArrayInt;
|
||||
export declare function addOneToPositiveArrayInt(arrayInt: ArrayInt): ArrayInt;
|
||||
export declare function substractArrayIntToNew(arrayIntA: ArrayInt, arrayIntB: ArrayInt): ArrayInt;
|
||||
export declare function trimArrayIntInplace(arrayInt: ArrayInt): ArrayInt;
|
||||
6
frontend/node_modules/pure-rand/lib/types/distribution/internals/ArrayInt64.d.ts
generated
vendored
Normal file
6
frontend/node_modules/pure-rand/lib/types/distribution/internals/ArrayInt64.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { ArrayInt } from './ArrayInt.js';
|
||||
export type ArrayInt64 = Required<ArrayInt> & {
|
||||
data: [number, number];
|
||||
};
|
||||
export declare function fromNumberToArrayInt64(out: ArrayInt64, n: number): ArrayInt64;
|
||||
export declare function substractArrayInt64(out: ArrayInt64, arrayIntA: ArrayInt64, arrayIntB: ArrayInt64): ArrayInt64;
|
||||
3
frontend/node_modules/pure-rand/lib/types/distribution/internals/UnsafeUniformArrayIntDistributionInternal.d.ts
generated
vendored
Normal file
3
frontend/node_modules/pure-rand/lib/types/distribution/internals/UnsafeUniformArrayIntDistributionInternal.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { RandomGenerator } from '../../types/RandomGenerator.js';
|
||||
import type { ArrayInt } from './ArrayInt.js';
|
||||
export declare function unsafeUniformArrayIntDistributionInternal(out: ArrayInt['data'], rangeSize: ArrayInt['data'], rng: RandomGenerator): ArrayInt['data'];
|
||||
2
frontend/node_modules/pure-rand/lib/types/distribution/internals/UnsafeUniformIntDistributionInternal.d.ts
generated
vendored
Normal file
2
frontend/node_modules/pure-rand/lib/types/distribution/internals/UnsafeUniformIntDistributionInternal.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { RandomGenerator } from '../../types/RandomGenerator.js';
|
||||
export declare function unsafeUniformIntDistributionInternal(rangeSize: number, rng: RandomGenerator): number;
|
||||
6
frontend/node_modules/pure-rand/lib/types/generator/LinearCongruential.d.ts
generated
vendored
Normal file
6
frontend/node_modules/pure-rand/lib/types/generator/LinearCongruential.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
declare function fromState(state: readonly number[]): RandomGenerator;
|
||||
export declare const congruential32: ((seed: number) => RandomGenerator) & {
|
||||
fromState: typeof fromState;
|
||||
};
|
||||
export {};
|
||||
6
frontend/node_modules/pure-rand/lib/types/generator/MersenneTwister.d.ts
generated
vendored
Normal file
6
frontend/node_modules/pure-rand/lib/types/generator/MersenneTwister.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
declare function fromState(state: readonly number[]): RandomGenerator;
|
||||
export declare const mersenne: ((seed: number) => RandomGenerator) & {
|
||||
fromState: typeof fromState;
|
||||
};
|
||||
export {};
|
||||
6
frontend/node_modules/pure-rand/lib/types/generator/XorShift.d.ts
generated
vendored
Normal file
6
frontend/node_modules/pure-rand/lib/types/generator/XorShift.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
declare function fromState(state: readonly number[]): RandomGenerator;
|
||||
export declare const xorshift128plus: ((seed: number) => RandomGenerator) & {
|
||||
fromState: typeof fromState;
|
||||
};
|
||||
export {};
|
||||
6
frontend/node_modules/pure-rand/lib/types/generator/XoroShiro.d.ts
generated
vendored
Normal file
6
frontend/node_modules/pure-rand/lib/types/generator/XoroShiro.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { RandomGenerator } from '../types/RandomGenerator.js';
|
||||
declare function fromState(state: readonly number[]): RandomGenerator;
|
||||
export declare const xoroshiro128plus: ((seed: number) => RandomGenerator) & {
|
||||
fromState: typeof fromState;
|
||||
};
|
||||
export {};
|
||||
20
frontend/node_modules/pure-rand/lib/types/pure-rand-default.d.ts
generated
vendored
Normal file
20
frontend/node_modules/pure-rand/lib/types/pure-rand-default.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { RandomGenerator } from './types/RandomGenerator.js';
|
||||
import { congruential32 } from './generator/LinearCongruential.js';
|
||||
import { mersenne } from './generator/MersenneTwister.js';
|
||||
import { xorshift128plus } from './generator/XorShift.js';
|
||||
import { xoroshiro128plus } from './generator/XoroShiro.js';
|
||||
import type { Distribution } from './types/Distribution.js';
|
||||
import { uniformArrayIntDistribution } from './distribution/UniformArrayIntDistribution.js';
|
||||
import { uniformBigIntDistribution } from './distribution/UniformBigIntDistribution.js';
|
||||
import { uniformIntDistribution } from './distribution/UniformIntDistribution.js';
|
||||
import { unsafeUniformArrayIntDistribution } from './distribution/UnsafeUniformArrayIntDistribution.js';
|
||||
import { unsafeUniformBigIntDistribution } from './distribution/UnsafeUniformBigIntDistribution.js';
|
||||
import { unsafeUniformIntDistribution } from './distribution/UnsafeUniformIntDistribution.js';
|
||||
import { skipN } from './distribution/SkipN.js';
|
||||
import { generateN } from './distribution/GenerateN.js';
|
||||
import { unsafeGenerateN } from './distribution/UnsafeGenerateN.js';
|
||||
import { unsafeSkipN } from './distribution/UnsafeSkipN.js';
|
||||
declare const __type: string;
|
||||
declare const __version: string;
|
||||
declare const __commitHash: string;
|
||||
export { __type, __version, __commitHash, RandomGenerator, generateN, skipN, unsafeGenerateN, unsafeSkipN, congruential32, mersenne, xorshift128plus, xoroshiro128plus, Distribution, uniformArrayIntDistribution, uniformBigIntDistribution, uniformIntDistribution, unsafeUniformArrayIntDistribution, unsafeUniformBigIntDistribution, unsafeUniformIntDistribution, };
|
||||
3
frontend/node_modules/pure-rand/lib/types/pure-rand.d.ts
generated
vendored
Normal file
3
frontend/node_modules/pure-rand/lib/types/pure-rand.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import * as prand from './pure-rand-default.js';
|
||||
export default prand;
|
||||
export * from './pure-rand-default.js';
|
||||
2
frontend/node_modules/pure-rand/lib/types/types/Distribution.d.ts
generated
vendored
Normal file
2
frontend/node_modules/pure-rand/lib/types/types/Distribution.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { RandomGenerator } from './RandomGenerator.js';
|
||||
export type Distribution<T> = (rng: RandomGenerator) => [T, RandomGenerator];
|
||||
8
frontend/node_modules/pure-rand/lib/types/types/RandomGenerator.d.ts
generated
vendored
Normal file
8
frontend/node_modules/pure-rand/lib/types/types/RandomGenerator.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export interface RandomGenerator {
|
||||
clone(): RandomGenerator;
|
||||
next(): [number, RandomGenerator];
|
||||
jump?(): RandomGenerator;
|
||||
unsafeNext(): number;
|
||||
unsafeJump?(): void;
|
||||
getState(): readonly number[];
|
||||
}
|
||||
115
frontend/node_modules/pure-rand/package.json
generated
vendored
Normal file
115
frontend/node_modules/pure-rand/package.json
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
{
|
||||
"name": "pure-rand",
|
||||
"version": "7.0.1",
|
||||
"description": " Pure random number generator written in TypeScript",
|
||||
"type": "commonjs",
|
||||
"main": "lib/pure-rand.js",
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
"./distribution/*": {
|
||||
"require": {
|
||||
"types": "./lib/types/distribution/*.d.ts",
|
||||
"default": "./lib/distribution/*.js"
|
||||
},
|
||||
"import": {
|
||||
"types": "./lib/esm/types/distribution/*.d.ts",
|
||||
"default": "./lib/esm/distribution/*.js"
|
||||
}
|
||||
},
|
||||
"./generator/*": {
|
||||
"require": {
|
||||
"types": "./lib/types/generator/*.d.ts",
|
||||
"default": "./lib/generator/*.js"
|
||||
},
|
||||
"import": {
|
||||
"types": "./lib/esm/types/generator/*.d.ts",
|
||||
"default": "./lib/esm/generator/*.js"
|
||||
}
|
||||
},
|
||||
"./types/*": {
|
||||
"require": {
|
||||
"types": "./lib/types/types/*.d.ts",
|
||||
"default": "./lib/types/*.js"
|
||||
},
|
||||
"import": {
|
||||
"types": "./lib/esm/types/types/*.d.ts",
|
||||
"default": "./lib/esm/types/*.js"
|
||||
}
|
||||
},
|
||||
".": {
|
||||
"require": {
|
||||
"types": "./lib/types/pure-rand.d.ts",
|
||||
"default": "./lib/pure-rand.js"
|
||||
},
|
||||
"import": {
|
||||
"types": "./lib/esm/types/pure-rand.d.ts",
|
||||
"default": "./lib/esm/pure-rand.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"module": "lib/esm/pure-rand.js",
|
||||
"types": "lib/types/pure-rand.d.ts",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"packageManager": "yarn@4.6.0",
|
||||
"scripts": {
|
||||
"format:check": "prettier --list-different .",
|
||||
"format": "prettier --write .",
|
||||
"build": "tsc && tsc -p ./tsconfig.declaration.json",
|
||||
"build:esm": "tsc --module es2015 --outDir lib/esm --moduleResolution node && tsc -p ./tsconfig.declaration.json --outDir lib/esm/types && cp package.esm-template.json lib/esm/package.json",
|
||||
"build:prod": "yarn build && yarn build:esm && node postbuild/main.mjs",
|
||||
"build:prod-ci": "cross-env EXPECT_GITHUB_SHA=true yarn build:prod",
|
||||
"test": "jest --config jest.config.js --coverage",
|
||||
"build:bench:old": "tsc --outDir lib-reference/",
|
||||
"build:bench:new": "tsc --outDir lib-test/",
|
||||
"bench": "node perf/benchmark.cjs"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/dubzzz/pure-rand.git"
|
||||
},
|
||||
"author": "Nicolas DUBIEN <github@dubien.org>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/dubzzz/pure-rand/issues"
|
||||
},
|
||||
"homepage": "https://github.com/dubzzz/pure-rand#readme",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/node": "^22.13.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"fast-check": "^3.23.2",
|
||||
"jest": "^29.7.0",
|
||||
"prettier": "3.4.2",
|
||||
"replace-in-file": "^8.3.0",
|
||||
"source-map-support": "^0.5.21",
|
||||
"tinybench": "^3.1.1",
|
||||
"ts-jest": "^29.2.5",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.5.3"
|
||||
},
|
||||
"keywords": [
|
||||
"seed",
|
||||
"random",
|
||||
"prng",
|
||||
"generator",
|
||||
"pure",
|
||||
"rand",
|
||||
"mersenne",
|
||||
"random number generator",
|
||||
"fastest",
|
||||
"fast"
|
||||
],
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/dubzzz"
|
||||
},
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/fast-check"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user