@thi.ng/random 4.1.27 → 4.1.30
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/package.json +161 -162
- package/CHANGELOG.md +0 -106
package/package.json
CHANGED
|
@@ -1,163 +1,162 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
2
|
+
"name": "@thi.ng/random",
|
|
3
|
+
"version": "4.1.30",
|
|
4
|
+
"description": "Pseudo-random number generators w/ unified API, distributions, weighted choices, ID generation",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "./index.js",
|
|
7
|
+
"typings": "./index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/thi-ng/umbrella.git"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://thi.ng/random",
|
|
14
|
+
"funding": [
|
|
15
|
+
{
|
|
16
|
+
"type": "github",
|
|
17
|
+
"url": "https://github.com/sponsors/postspectacular"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"type": "patreon",
|
|
21
|
+
"url": "https://patreon.com/thing_umbrella"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "liberapay",
|
|
25
|
+
"url": "https://liberapay.com/thi.ng"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"author": "Karsten Schmidt (https://thi.ng)",
|
|
29
|
+
"license": "Apache-2.0",
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "yarn build:esbuild && yarn build:decl",
|
|
32
|
+
"build:decl": "tsc --declaration --emitDeclarationOnly",
|
|
33
|
+
"build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
|
|
34
|
+
"clean": "bun ../../tools/src/clean-package.ts distributions",
|
|
35
|
+
"doc": "typedoc --options ../../typedoc.json --out doc src/index.ts",
|
|
36
|
+
"doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
|
|
37
|
+
"pub": "npm publish --access public",
|
|
38
|
+
"test": "bun test",
|
|
39
|
+
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@thi.ng/api": "^8.12.5",
|
|
43
|
+
"@thi.ng/errors": "^2.5.45"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"esbuild": "^0.25.11",
|
|
47
|
+
"typedoc": "^0.28.14",
|
|
48
|
+
"typescript": "^5.9.3"
|
|
49
|
+
},
|
|
50
|
+
"keywords": [
|
|
51
|
+
"binary",
|
|
52
|
+
"crypto",
|
|
53
|
+
"datastructure",
|
|
54
|
+
"distribution",
|
|
55
|
+
"exponential",
|
|
56
|
+
"gaussian",
|
|
57
|
+
"generator",
|
|
58
|
+
"geometric",
|
|
59
|
+
"normal",
|
|
60
|
+
"prng",
|
|
61
|
+
"random",
|
|
62
|
+
"typedarray",
|
|
63
|
+
"typescript",
|
|
64
|
+
"uniform",
|
|
65
|
+
"weighted"
|
|
66
|
+
],
|
|
67
|
+
"publishConfig": {
|
|
68
|
+
"access": "public"
|
|
69
|
+
},
|
|
70
|
+
"engines": {
|
|
71
|
+
"node": ">=18"
|
|
72
|
+
},
|
|
73
|
+
"files": [
|
|
74
|
+
"./*.js",
|
|
75
|
+
"./*.d.ts",
|
|
76
|
+
"distributions"
|
|
77
|
+
],
|
|
78
|
+
"exports": {
|
|
79
|
+
".": {
|
|
80
|
+
"default": "./index.js"
|
|
81
|
+
},
|
|
82
|
+
"./api": {
|
|
83
|
+
"default": "./api.js"
|
|
84
|
+
},
|
|
85
|
+
"./arandom": {
|
|
86
|
+
"default": "./arandom.js"
|
|
87
|
+
},
|
|
88
|
+
"./coin": {
|
|
89
|
+
"default": "./coin.js"
|
|
90
|
+
},
|
|
91
|
+
"./constants": {
|
|
92
|
+
"default": "./constants.js"
|
|
93
|
+
},
|
|
94
|
+
"./crypto": {
|
|
95
|
+
"default": "./crypto.js"
|
|
96
|
+
},
|
|
97
|
+
"./distributions/exponential": {
|
|
98
|
+
"default": "./distributions/exponential.js"
|
|
99
|
+
},
|
|
100
|
+
"./distributions/gaussian": {
|
|
101
|
+
"default": "./distributions/gaussian.js"
|
|
102
|
+
},
|
|
103
|
+
"./distributions/geometric": {
|
|
104
|
+
"default": "./distributions/geometric.js"
|
|
105
|
+
},
|
|
106
|
+
"./distributions/normal": {
|
|
107
|
+
"default": "./distributions/normal.js"
|
|
108
|
+
},
|
|
109
|
+
"./distributions/uniform": {
|
|
110
|
+
"default": "./distributions/uniform.js"
|
|
111
|
+
},
|
|
112
|
+
"./pick-random": {
|
|
113
|
+
"default": "./pick-random.js"
|
|
114
|
+
},
|
|
115
|
+
"./random-bytes": {
|
|
116
|
+
"default": "./random-bytes.js"
|
|
117
|
+
},
|
|
118
|
+
"./random-id": {
|
|
119
|
+
"default": "./random-id.js"
|
|
120
|
+
},
|
|
121
|
+
"./sfc32": {
|
|
122
|
+
"default": "./sfc32.js"
|
|
123
|
+
},
|
|
124
|
+
"./smush32": {
|
|
125
|
+
"default": "./smush32.js"
|
|
126
|
+
},
|
|
127
|
+
"./system": {
|
|
128
|
+
"default": "./system.js"
|
|
129
|
+
},
|
|
130
|
+
"./unique-indices": {
|
|
131
|
+
"default": "./unique-indices.js"
|
|
132
|
+
},
|
|
133
|
+
"./weighted-probability": {
|
|
134
|
+
"default": "./weighted-probability.js"
|
|
135
|
+
},
|
|
136
|
+
"./weighted-random": {
|
|
137
|
+
"default": "./weighted-random.js"
|
|
138
|
+
},
|
|
139
|
+
"./wrapped": {
|
|
140
|
+
"default": "./wrapped.js"
|
|
141
|
+
},
|
|
142
|
+
"./xorshift128": {
|
|
143
|
+
"default": "./xorshift128.js"
|
|
144
|
+
},
|
|
145
|
+
"./xorwow": {
|
|
146
|
+
"default": "./xorwow.js"
|
|
147
|
+
},
|
|
148
|
+
"./xoshiro128": {
|
|
149
|
+
"default": "./xoshiro128.js"
|
|
150
|
+
},
|
|
151
|
+
"./xsadd": {
|
|
152
|
+
"default": "./xsadd.js"
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"thi.ng": {
|
|
156
|
+
"alias": "rnd",
|
|
157
|
+
"year": 2015,
|
|
158
|
+
"related": [
|
|
159
|
+
"ksuid"
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
- **Last updated**: 2025-09-01T16:38:35Z
|
|
4
|
-
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
|
-
|
|
6
|
-
All notable changes to this project will be documented in this file.
|
|
7
|
-
Only versions published since **2022-01-01** are listed here.
|
|
8
|
-
Please consult the Git history for older version information.
|
|
9
|
-
See [Conventional Commits](https://conventionalcommits.org/) for commit guidelines.
|
|
10
|
-
|
|
11
|
-
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
12
|
-
and/or version bumps of transitive dependencies.
|
|
13
|
-
|
|
14
|
-
### [4.1.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/random@4.1.1) (2024-10-07)
|
|
15
|
-
|
|
16
|
-
#### 🩹 Bug fixes
|
|
17
|
-
|
|
18
|
-
- add missing pkg export (WrappedRandom) ([8e4f7d5](https://github.com/thi-ng/umbrella/commit/8e4f7d5))
|
|
19
|
-
|
|
20
|
-
## [4.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/random@4.1.0) (2024-10-05)
|
|
21
|
-
|
|
22
|
-
#### 🚀 Features
|
|
23
|
-
|
|
24
|
-
- add WrappedRandom, refactor SYSTEM ([73c863f](https://github.com/thi-ng/umbrella/commit/73c863f))
|
|
25
|
-
- replace `SystemRandom` with `WrappedRandom` class
|
|
26
|
-
- refactor `SYSTEM`
|
|
27
|
-
|
|
28
|
-
# [4.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/random@4.0.0) (2024-07-22)
|
|
29
|
-
|
|
30
|
-
#### 🛑 Breaking changes
|
|
31
|
-
|
|
32
|
-
- migrate/remove UUID functions ([#486](https://github.com/thi-ng/umbrella/issues/486)) ([2ec753e](https://github.com/thi-ng/umbrella/commit/2ec753e))
|
|
33
|
-
- BREAKING CHANGE: migrate UUID functions to [@thi.ng/uuid](https://github.com/thi-ng/umbrella/tree/main/packages/uuid) pkg
|
|
34
|
-
- remove obsolete files
|
|
35
|
-
- update deps/pkg
|
|
36
|
-
- update readme
|
|
37
|
-
|
|
38
|
-
## [3.8.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/random@3.8.0) (2024-05-08)
|
|
39
|
-
|
|
40
|
-
#### 🚀 Features
|
|
41
|
-
|
|
42
|
-
- add rdom-klist example project, update readmes ([cd458ac](https://github.com/thi-ng/umbrella/commit/cd458ac))
|
|
43
|
-
- add rdom-klist example project, update readmes ([531437f](https://github.com/thi-ng/umbrella/commit/531437f))
|
|
44
|
-
|
|
45
|
-
## [3.7.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/random@3.7.0) (2024-03-21)
|
|
46
|
-
|
|
47
|
-
#### 🚀 Features
|
|
48
|
-
|
|
49
|
-
- add weightedProbability() ([393dcaa](https://github.com/thi-ng/umbrella/commit/393dcaa))
|
|
50
|
-
|
|
51
|
-
### [3.6.13](https://github.com/thi-ng/umbrella/tree/@thi.ng/random@3.6.13) (2023-11-09)
|
|
52
|
-
|
|
53
|
-
#### ♻️ Refactoring
|
|
54
|
-
|
|
55
|
-
- update all tests (packages A-S) ([e3085e4](https://github.com/thi-ng/umbrella/commit/e3085e4))
|
|
56
|
-
|
|
57
|
-
### [3.6.6](https://github.com/thi-ng/umbrella/tree/@thi.ng/random@3.6.6) (2023-10-05)
|
|
58
|
-
|
|
59
|
-
#### 🩹 Bug fixes
|
|
60
|
-
|
|
61
|
-
- update ARandom.minmaxInt/Uint() ([33c35b4](https://github.com/thi-ng/umbrella/commit/33c35b4))
|
|
62
|
-
- fix NaN bug iff min == max
|
|
63
|
-
|
|
64
|
-
### [3.6.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/random@3.6.1) (2023-08-12)
|
|
65
|
-
|
|
66
|
-
#### ⏱ Performance improvements
|
|
67
|
-
|
|
68
|
-
- add/re-use internal buf for uuid() ([6bf7f1d](https://github.com/thi-ng/umbrella/commit/6bf7f1d))
|
|
69
|
-
- avoid temp allocations (10% faster)
|
|
70
|
-
|
|
71
|
-
## [3.6.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/random@3.6.0) (2023-08-12)
|
|
72
|
-
|
|
73
|
-
#### 🚀 Features
|
|
74
|
-
|
|
75
|
-
- add IRandom.minmaxUint() ([6558eb1](https://github.com/thi-ng/umbrella/commit/6558eb1))
|
|
76
|
-
- clarify .minmaxInt() is for signed (i32)
|
|
77
|
-
- new .minmaxUint() is for unsigned (u32)
|
|
78
|
-
- add ARandom.minmaxUint()
|
|
79
|
-
- add IRandom.probability() ([efdd49c](https://github.com/thi-ng/umbrella/commit/efdd49c))
|
|
80
|
-
- add impl for ARandom base class
|
|
81
|
-
|
|
82
|
-
#### ⏱ Performance improvements
|
|
83
|
-
|
|
84
|
-
- increase Crypto default size to 1KB ([a30075a](https://github.com/thi-ng/umbrella/commit/a30075a))
|
|
85
|
-
- minor update randomBytesFrom() ([770dbe5](https://github.com/thi-ng/umbrella/commit/770dbe5))
|
|
86
|
-
- switch loop direction
|
|
87
|
-
|
|
88
|
-
## [3.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/random@3.5.0) (2023-07-14)
|
|
89
|
-
|
|
90
|
-
#### 🚀 Features
|
|
91
|
-
|
|
92
|
-
- add pickRandomUnique() ([a70c951](https://github.com/thi-ng/umbrella/commit/a70c951))
|
|
93
|
-
- add generics for uniqueValuesFrom()
|
|
94
|
-
|
|
95
|
-
## [3.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/random@3.4.0) (2023-04-19)
|
|
96
|
-
|
|
97
|
-
#### 🚀 Features
|
|
98
|
-
|
|
99
|
-
- add INorm.normMinMax(), update ARandom ([89c6b76](https://github.com/thi-ng/umbrella/commit/89c6b76))
|
|
100
|
-
|
|
101
|
-
## [3.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/random@3.3.0) (2022-05-22)
|
|
102
|
-
|
|
103
|
-
#### 🚀 Features
|
|
104
|
-
|
|
105
|
-
- update IRandom, add SFC32 impl ([970d7f4](https://github.com/thi-ng/umbrella/commit/970d7f4))
|
|
106
|
-
- add pickRandomKey(), weightedRandomKey() ([9b8ed07](https://github.com/thi-ng/umbrella/commit/9b8ed07))
|