@thi.ng/random 3.6.11 → 3.6.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2023-10-30T14:31:56Z
3
+ - **Last updated**: 2023-11-09T10:02:12Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
9
9
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
10
  and/or version bumps of transitive dependencies.
11
11
 
12
+ ### [3.6.13](https://github.com/thi-ng/umbrella/tree/@thi.ng/random@3.6.13) (2023-11-09)
13
+
14
+ #### ♻️ Refactoring
15
+
16
+ - update all tests (packages A-S) ([e3085e4](https://github.com/thi-ng/umbrella/commit/e3085e4))
17
+
12
18
  ### [3.6.6](https://github.com/thi-ng/umbrella/tree/@thi.ng/random@3.6.6) (2023-10-05)
13
19
 
14
20
  #### 🩹 Bug fixes
package/README.md CHANGED
@@ -94,7 +94,7 @@ For Node.js REPL:
94
94
  const random = await import("@thi.ng/random");
95
95
  ```
96
96
 
97
- Package sizes (brotli'd, pre-treeshake): ESM: 1.88 KB
97
+ Package sizes (brotli'd, pre-treeshake): ESM: 1.99 KB
98
98
 
99
99
  ## Dependencies
100
100
 
@@ -109,22 +109,23 @@ Several projects in this repo's
109
109
  [/examples](https://github.com/thi-ng/umbrella/tree/develop/examples)
110
110
  directory are using this package:
111
111
 
112
- | Screenshot | Description | Live demo | Source |
113
- |:-----------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------|:------------------------------------------------------------|:-----------------------------------------------------------------------------------------|
114
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/canvas-recorder.png" width="240"/> | Self-modifying, animated typographic grid with emergent complex patterns | [Demo](https://demo.thi.ng/umbrella/canvas-recorder/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/canvas-recorder) |
115
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/color-themes.png" width="240"/> | Probabilistic color theme generator | [Demo](https://demo.thi.ng/umbrella/color-themes/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/color-themes) |
116
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/fft-synth.png" width="240"/> | Interactive inverse FFT toy synth | [Demo](https://demo.thi.ng/umbrella/fft-synth/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/fft-synth) |
117
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/hdom-canvas-particles.jpg" width="240"/> | 2D Bezier curve-guided particle system | [Demo](https://demo.thi.ng/umbrella/hdom-canvas-particles/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/hdom-canvas-particles) |
118
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/ifs-fractal.jpg" width="240"/> | Barnsley fern IFS fractal renderer | [Demo](https://demo.thi.ng/umbrella/ifs-fractal/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/ifs-fractal) |
119
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/kmeans-viz.jpg" width="240"/> | k-means clustering visualization | [Demo](https://demo.thi.ng/umbrella/kmeans-viz/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/kmeans-viz) |
120
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/layout-gridgen.png" width="240"/> | Randomized space-filling, nested grid layout generator | [Demo](https://demo.thi.ng/umbrella/layout-gridgen/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/layout-gridgen) |
121
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/pixel-gradients.jpg" width="240"/> | Randomized 4-point 2D color gradient image generator | [Demo](https://demo.thi.ng/umbrella/pixel-gradients/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/pixel-gradients) |
122
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/pixel-sorting.png" width="240"/> | Interactive pixel sorting tool using thi.ng/color & thi.ng/pixel | [Demo](https://demo.thi.ng/umbrella/pixel-sorting/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/pixel-sorting) |
123
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/poly-subdiv.jpg" width="240"/> | Animated, iterative polygon subdivisions & visualization | [Demo](https://demo.thi.ng/umbrella/poly-subdiv/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/poly-subdiv) |
124
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/render-audio.png" width="240"/> | Generative audio synth offline renderer and WAV file export | [Demo](https://demo.thi.ng/umbrella/render-audio/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/render-audio) |
125
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-ast-evo.jpg" width="240"/> | Evolutionary shader generation using genetic programming | [Demo](https://demo.thi.ng/umbrella/shader-ast-evo/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-ast-evo) |
126
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/stacked-layout.png" width="240"/> | Responsive & reactively computed stacked column layout | [Demo](https://demo.thi.ng/umbrella/stacked-layout/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/stacked-layout) |
127
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-game-of-life.png" width="240"/> | Game of Life implemented as WebGL2 multi-pass shader pipeline | [Demo](https://demo.thi.ng/umbrella/webgl-game-of-life/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-game-of-life) |
112
+ | Screenshot | Description | Live demo | Source |
113
+ |:-----------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------|:------------------------------------------------------------|:-----------------------------------------------------------------------------------------|
114
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/canvas-recorder.png" width="240"/> | Self-modifying, animated typographic grid with emergent complex patterns | [Demo](https://demo.thi.ng/umbrella/canvas-recorder/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/canvas-recorder) |
115
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/color-themes.png" width="240"/> | Probabilistic color theme generator | [Demo](https://demo.thi.ng/umbrella/color-themes/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/color-themes) |
116
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/fft-synth.png" width="240"/> | Interactive inverse FFT toy synth | [Demo](https://demo.thi.ng/umbrella/fft-synth/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/fft-synth) |
117
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/hdom-canvas-particles.jpg" width="240"/> | 2D Bezier curve-guided particle system | [Demo](https://demo.thi.ng/umbrella/hdom-canvas-particles/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/hdom-canvas-particles) |
118
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/ifs-fractal.jpg" width="240"/> | Barnsley fern IFS fractal renderer | [Demo](https://demo.thi.ng/umbrella/ifs-fractal/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/ifs-fractal) |
119
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/kmeans-viz.jpg" width="240"/> | k-means clustering visualization | [Demo](https://demo.thi.ng/umbrella/kmeans-viz/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/kmeans-viz) |
120
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/layout-gridgen.png" width="240"/> | Randomized space-filling, nested grid layout generator | [Demo](https://demo.thi.ng/umbrella/layout-gridgen/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/layout-gridgen) |
121
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/pixel-gradients.jpg" width="240"/> | Randomized 4-point 2D color gradient image generator | [Demo](https://demo.thi.ng/umbrella/pixel-gradients/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/pixel-gradients) |
122
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/pixel-sorting.png" width="240"/> | Interactive pixel sorting tool using thi.ng/color & thi.ng/pixel | [Demo](https://demo.thi.ng/umbrella/pixel-sorting/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/pixel-sorting) |
123
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/poly-subdiv.jpg" width="240"/> | Animated, iterative polygon subdivisions & visualization | [Demo](https://demo.thi.ng/umbrella/poly-subdiv/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/poly-subdiv) |
124
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/procedural-text.jpg" width="240"/> | Procedural stochastic text generation via custom DSL, parse grammar & AST transformation | [Demo](https://demo.thi.ng/umbrella/procedural-text/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/procedural-text) |
125
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/render-audio.png" width="240"/> | Generative audio synth offline renderer and WAV file export | [Demo](https://demo.thi.ng/umbrella/render-audio/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/render-audio) |
126
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-ast-evo.jpg" width="240"/> | Evolutionary shader generation using genetic programming | [Demo](https://demo.thi.ng/umbrella/shader-ast-evo/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-ast-evo) |
127
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/stacked-layout.png" width="240"/> | Responsive & reactively computed stacked column layout | [Demo](https://demo.thi.ng/umbrella/stacked-layout/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/stacked-layout) |
128
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-game-of-life.png" width="240"/> | Game of Life implemented as WebGL2 multi-pass shader pipeline | [Demo](https://demo.thi.ng/umbrella/webgl-game-of-life/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-game-of-life) |
128
129
 
129
130
  ## API
130
131
 
package/crypto.js CHANGED
@@ -11,6 +11,9 @@ import { randomBytes } from "./random-bytes.js";
11
11
  *
12
12
  */
13
13
  export class Crypto extends ARandom {
14
+ buffer;
15
+ u32;
16
+ i;
14
17
  /**
15
18
  * @param size - buffer size in bytes (will be rounded to next multiple of 4)
16
19
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/random",
3
- "version": "3.6.11",
3
+ "version": "3.6.13",
4
4
  "description": "Pseudo-random number generators w/ unified API, distributions, weighted choices, ID generation",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -28,23 +28,22 @@
28
28
  "clean": "rimraf --glob '*.js' '*.d.ts' '*.map' doc distributions",
29
29
  "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
30
30
  "doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
31
- "doc:readme": "yarn doc:stats && tools:readme",
32
- "doc:stats": "tools:module-stats",
31
+ "doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
33
32
  "pub": "yarn npm publish --access public",
34
- "test": "testament test"
33
+ "test": "bun test"
35
34
  },
36
35
  "dependencies": {
37
- "@thi.ng/api": "^8.9.6",
38
- "@thi.ng/checks": "^3.4.6",
39
- "@thi.ng/errors": "^2.4.0",
40
- "@thi.ng/hex": "^2.3.18"
36
+ "@thi.ng/api": "^8.9.7",
37
+ "@thi.ng/checks": "^3.4.7",
38
+ "@thi.ng/errors": "^2.4.1",
39
+ "@thi.ng/hex": "^2.3.19"
41
40
  },
42
41
  "devDependencies": {
43
- "@microsoft/api-extractor": "^7.38.0",
44
- "@thi.ng/testament": "^0.3.24",
42
+ "@microsoft/api-extractor": "^7.38.2",
43
+ "@thi.ng/testament": "^0.4.0",
45
44
  "rimraf": "^5.0.5",
46
45
  "tools": "^0.0.1",
47
- "typedoc": "^0.25.2",
46
+ "typedoc": "^0.25.3",
48
47
  "typescript": "^5.2.2"
49
48
  },
50
49
  "keywords": [
@@ -156,5 +155,5 @@
156
155
  "ksuid"
157
156
  ]
158
157
  },
159
- "gitHead": "bfa16829786146bd24df3cdbd44649a45a603e44\n"
158
+ "gitHead": "9f4d8ad79bca1d68214fbc9bbc5fb55f5a445f7e\n"
160
159
  }
package/sfc32.js CHANGED
@@ -8,6 +8,7 @@ import { DEFAULT_SEED_128 } from "./constants.js";
8
8
  * - http://pracrand.sourceforge.net/
9
9
  */
10
10
  export class SFC32 extends ARandom {
11
+ buffer;
11
12
  constructor(seed = DEFAULT_SEED_128) {
12
13
  super();
13
14
  this.buffer = new Uint32Array(4);
package/smush32.js CHANGED
@@ -8,6 +8,7 @@ import { DEFAULT_SEED_32 } from "./constants.js";
8
8
  * - https://gist.github.com/voidqk/d112165a26b45244a65298933c0349a4
9
9
  */
10
10
  export class Smush32 extends ARandom {
11
+ buffer;
11
12
  constructor(seed = DEFAULT_SEED_32) {
12
13
  super();
13
14
  this.buffer = new Uint32Array([seed, 0]);
package/xorshift128.js CHANGED
@@ -5,6 +5,7 @@ import { DEFAULT_SEED_128 } from "./constants.js";
5
5
  * Reference: https://en.wikipedia.org/wiki/Xorshift
6
6
  */
7
7
  export class XorShift128 extends ARandom {
8
+ buffer;
8
9
  constructor(seed = DEFAULT_SEED_128) {
9
10
  super();
10
11
  this.buffer = new Uint32Array(4);
package/xorwow.js CHANGED
@@ -5,6 +5,7 @@ import { DEFAULT_SEED_160 } from "./constants.js";
5
5
  * Reference: https://en.wikipedia.org/wiki/Xorshift#xorwow
6
6
  */
7
7
  export class XorWow extends ARandom {
8
+ buffer;
8
9
  constructor(seed = DEFAULT_SEED_160) {
9
10
  super();
10
11
  this.buffer = new Uint32Array(5);
package/xoshiro128.js CHANGED
@@ -7,6 +7,7 @@ import { DEFAULT_SEED_128 } from "./constants.js";
7
7
  * - http://prng.di.unimi.it/xoshiro128plusplus.c
8
8
  */
9
9
  export class Xoshiro128 extends ARandom {
10
+ buffer;
10
11
  constructor(seed = DEFAULT_SEED_128) {
11
12
  super();
12
13
  this.buffer = new Uint32Array(4);
package/xsadd.js CHANGED
@@ -5,6 +5,7 @@ import { DEFAULT_SEED_32 } from "./constants.js";
5
5
  * Reference: https://github.com/MersenneTwister-Lab/XSadd/blob/develop/xsadd.h
6
6
  */
7
7
  export class XsAdd extends ARandom {
8
+ buffer;
8
9
  constructor(seed = DEFAULT_SEED_32) {
9
10
  super();
10
11
  this.buffer = new Uint32Array(4);