@thi.ng/random 3.3.17 → 3.3.19
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 +1 -1
- package/README.md +7 -10
- package/api.d.ts +1 -1
- package/distributions/gaussian.d.ts +1 -1
- package/distributions/gaussian.js +1 -1
- package/package.json +11 -11
- package/random-id.d.ts +2 -1
- package/random-id.js +2 -1
- package/weighted-random.d.ts +1 -1
- package/weighted-random.js +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<!-- This file is generated - DO NOT EDIT! -->
|
|
2
2
|
|
|
3
|
-
# 
|
|
3
|
+
# 
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@thi.ng/random)
|
|
6
6
|

|
|
7
|
-
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
This project is part of the
|
|
10
10
|
[@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo.
|
|
@@ -24,7 +24,7 @@ This project is part of the
|
|
|
24
24
|
|
|
25
25
|
## About
|
|
26
26
|
|
|
27
|
-
Pseudo-random number generators w/ unified API, distributions, weighted choices, ID generation
|
|
27
|
+
Pseudo-random number generators w/ unified API, distributions, weighted choices, ID generation
|
|
28
28
|
|
|
29
29
|
This package provides the `IRandom` interface and various (mostly seedable)
|
|
30
30
|
pseudo-random number generator implementations, incl. `IRandom` wrappers for
|
|
@@ -89,11 +89,8 @@ ES module import:
|
|
|
89
89
|
|
|
90
90
|
For Node.js REPL:
|
|
91
91
|
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
node --experimental-repl-await
|
|
95
|
-
|
|
96
|
-
> const random = await import("@thi.ng/random");
|
|
92
|
+
```js
|
|
93
|
+
const random = await import("@thi.ng/random");
|
|
97
94
|
```
|
|
98
95
|
|
|
99
96
|
Package sizes (brotli'd, pre-treeshake): ESM: 1.83 KB
|
|
@@ -154,7 +151,7 @@ rnd.minmaxInt(10, 20)
|
|
|
154
151
|
|
|
155
152
|
## Authors
|
|
156
153
|
|
|
157
|
-
Karsten Schmidt
|
|
154
|
+
- [Karsten Schmidt](https://thi.ng)
|
|
158
155
|
|
|
159
156
|
If this project contributes to an academic publication, please cite it as:
|
|
160
157
|
|
|
@@ -169,4 +166,4 @@ If this project contributes to an academic publication, please cite it as:
|
|
|
169
166
|
|
|
170
167
|
## License
|
|
171
168
|
|
|
172
|
-
© 2015 - 2022 Karsten Schmidt // Apache
|
|
169
|
+
© 2015 - 2022 Karsten Schmidt // Apache License 2.0
|
package/api.d.ts
CHANGED
|
@@ -40,5 +40,5 @@ export interface IRandom extends INorm {
|
|
|
40
40
|
export interface ISeedable<T> {
|
|
41
41
|
seed(n: T): this;
|
|
42
42
|
}
|
|
43
|
-
export
|
|
43
|
+
export type ISeedableRandom<T> = IRandom & ISeedable<T> & ICopy<IRandom>;
|
|
44
44
|
//# sourceMappingURL=api.d.ts.map
|
|
@@ -8,7 +8,7 @@ import type { IRandom } from "../api.js";
|
|
|
8
8
|
* The default configuration produces samples in the approx. [-0.5,0.5] range
|
|
9
9
|
* with a ~12% standard deviation.
|
|
10
10
|
*
|
|
11
|
-
* Reference:
|
|
11
|
+
* Reference: https://en.wikipedia.org/wiki/Central_limit_theorem
|
|
12
12
|
*
|
|
13
13
|
* @param rnd - default `SYSTEM`
|
|
14
14
|
* @param n - num samples, default 24
|
|
@@ -8,7 +8,7 @@ import { SYSTEM } from "../system.js";
|
|
|
8
8
|
* The default configuration produces samples in the approx. [-0.5,0.5] range
|
|
9
9
|
* with a ~12% standard deviation.
|
|
10
10
|
*
|
|
11
|
-
* Reference:
|
|
11
|
+
* Reference: https://en.wikipedia.org/wiki/Central_limit_theorem
|
|
12
12
|
*
|
|
13
13
|
* @param rnd - default `SYSTEM`
|
|
14
14
|
* @param n - num samples, default 24
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/random",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.19",
|
|
4
4
|
"description": "Pseudo-random number generators w/ unified API, distributions, weighted choices, ID generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "https://patreon.com/thing_umbrella"
|
|
22
22
|
}
|
|
23
23
|
],
|
|
24
|
-
"author": "Karsten Schmidt
|
|
24
|
+
"author": "Karsten Schmidt (https://thi.ng)",
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "yarn clean && tsc --declaration",
|
|
@@ -34,18 +34,18 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.
|
|
38
|
-
"@thi.ng/checks": "^3.3.
|
|
39
|
-
"@thi.ng/errors": "^2.2.
|
|
40
|
-
"@thi.ng/hex": "^2.3.
|
|
37
|
+
"@thi.ng/api": "^8.6.1",
|
|
38
|
+
"@thi.ng/checks": "^3.3.5",
|
|
39
|
+
"@thi.ng/errors": "^2.2.6",
|
|
40
|
+
"@thi.ng/hex": "^2.3.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@microsoft/api-extractor": "^7.33.
|
|
44
|
-
"@thi.ng/testament": "^0.3.
|
|
43
|
+
"@microsoft/api-extractor": "^7.33.7",
|
|
44
|
+
"@thi.ng/testament": "^0.3.7",
|
|
45
45
|
"rimraf": "^3.0.2",
|
|
46
46
|
"tools": "^0.0.1",
|
|
47
|
-
"typedoc": "^0.23.
|
|
48
|
-
"typescript": "^4.
|
|
47
|
+
"typedoc": "^0.23.22",
|
|
48
|
+
"typescript": "^4.9.4"
|
|
49
49
|
},
|
|
50
50
|
"keywords": [
|
|
51
51
|
"binary",
|
|
@@ -156,5 +156,5 @@
|
|
|
156
156
|
"ksuid"
|
|
157
157
|
]
|
|
158
158
|
},
|
|
159
|
-
"gitHead": "
|
|
159
|
+
"gitHead": "7b2af448da8a63fb21704a79cc4cdf1f3d7d7a64\n"
|
|
160
160
|
}
|
package/random-id.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ import type { IRandom } from "./api.js";
|
|
|
5
5
|
* lowercase a-z).
|
|
6
6
|
*
|
|
7
7
|
* @remarks
|
|
8
|
-
* See
|
|
8
|
+
* See [thi.ng/ksuid](https://thi.ng/thi.ng/ksuid) for a more advanced and
|
|
9
|
+
* collision-free approach.
|
|
9
10
|
*
|
|
10
11
|
* @example
|
|
11
12
|
* ```ts
|
package/random-id.js
CHANGED
|
@@ -5,7 +5,8 @@ import { SYSTEM } from "./system.js";
|
|
|
5
5
|
* lowercase a-z).
|
|
6
6
|
*
|
|
7
7
|
* @remarks
|
|
8
|
-
* See
|
|
8
|
+
* See [thi.ng/ksuid](https://thi.ng/thi.ng/ksuid) for a more advanced and
|
|
9
|
+
* collision-free approach.
|
|
9
10
|
*
|
|
10
11
|
* @example
|
|
11
12
|
* ```ts
|
package/weighted-random.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import type { IRandom } from "./api.js";
|
|
|
13
13
|
* the resulting function will only ever return the first `choice`.
|
|
14
14
|
*
|
|
15
15
|
* Based on:
|
|
16
|
-
*
|
|
16
|
+
* https://www.electricmonk.nl/log/2009/12/23/weighted-random-distribution/
|
|
17
17
|
*
|
|
18
18
|
* @param choices -
|
|
19
19
|
* @param weights - optional weights
|
package/weighted-random.js
CHANGED
|
@@ -13,7 +13,7 @@ import { SYSTEM } from "./system.js";
|
|
|
13
13
|
* the resulting function will only ever return the first `choice`.
|
|
14
14
|
*
|
|
15
15
|
* Based on:
|
|
16
|
-
*
|
|
16
|
+
* https://www.electricmonk.nl/log/2009/12/23/weighted-random-distribution/
|
|
17
17
|
*
|
|
18
18
|
* @param choices -
|
|
19
19
|
* @param weights - optional weights
|