@thi.ng/random 4.1.10 → 4.1.11
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/api.d.ts +7 -7
- package/distributions/gaussian.d.ts +1 -1
- package/distributions/geometric.d.ts +1 -1
- package/package.json +6 -6
- package/sfc32.d.ts +2 -2
- package/smush32.d.ts +1 -1
- package/weighted-probability.d.ts +2 -2
- package/xoshiro128.d.ts +1 -0
package/CHANGELOG.md
CHANGED
package/api.d.ts
CHANGED
|
@@ -27,14 +27,14 @@ export interface INorm {
|
|
|
27
27
|
}
|
|
28
28
|
export interface IRandom extends INorm {
|
|
29
29
|
/**
|
|
30
|
-
* Returns unsigned 32bit int in [0
|
|
30
|
+
* Returns unsigned 32bit int in `[0,0xffffffff]` interval.
|
|
31
31
|
*
|
|
32
32
|
* @remarks
|
|
33
33
|
* See: https://github.com/thi-ng/umbrella/wiki/Glossary#interval
|
|
34
34
|
*/
|
|
35
35
|
int(): number;
|
|
36
36
|
/**
|
|
37
|
-
* Returns float in [0
|
|
37
|
+
* Returns float in `[0,max)` interval.
|
|
38
38
|
*
|
|
39
39
|
* @remarks
|
|
40
40
|
* See: https://github.com/thi-ng/umbrella/wiki/Glossary#interval
|
|
@@ -43,14 +43,14 @@ export interface IRandom extends INorm {
|
|
|
43
43
|
*/
|
|
44
44
|
float(max?: number): number;
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
46
|
+
* Calls {@link IRandom.float} and returns true iff result is < `p` (assumed
|
|
47
|
+
* to be in `[0,1]` interval).
|
|
48
48
|
*
|
|
49
49
|
* @param p
|
|
50
50
|
*/
|
|
51
51
|
probability(p: number): boolean;
|
|
52
52
|
/**
|
|
53
|
-
* Returns float in [min
|
|
53
|
+
* Returns float in `[min,max)` interval.
|
|
54
54
|
*
|
|
55
55
|
* @remarks
|
|
56
56
|
* See: https://github.com/thi-ng/umbrella/wiki/Glossary#interval
|
|
@@ -60,7 +60,7 @@ export interface IRandom extends INorm {
|
|
|
60
60
|
*/
|
|
61
61
|
minmax(min: number, max: number): number;
|
|
62
62
|
/**
|
|
63
|
-
* Returns int in **signed** integer [min
|
|
63
|
+
* Returns int in **signed** integer `[min,max)` interval.
|
|
64
64
|
*
|
|
65
65
|
* @remarks
|
|
66
66
|
* See: https://github.com/thi-ng/umbrella/wiki/Glossary#interval
|
|
@@ -70,7 +70,7 @@ export interface IRandom extends INorm {
|
|
|
70
70
|
*/
|
|
71
71
|
minmaxInt(min: number, max: number): number;
|
|
72
72
|
/**
|
|
73
|
-
* Returns int in **unsigned** integer [min
|
|
73
|
+
* Returns int in **unsigned** integer `[min,max)` interval.
|
|
74
74
|
*
|
|
75
75
|
* @remarks
|
|
76
76
|
* See: https://github.com/thi-ng/umbrella/wiki/Glossary#interval
|
|
@@ -5,7 +5,7 @@ import type { IRandom } from "../api.js";
|
|
|
5
5
|
* (Central Limit Theorem).
|
|
6
6
|
*
|
|
7
7
|
* @remarks
|
|
8
|
-
* The default configuration produces samples in the approx. [-0.5,0.5] range
|
|
8
|
+
* The default configuration produces samples in the approx. `[-0.5,0.5]` range
|
|
9
9
|
* with a ~12% standard deviation.
|
|
10
10
|
*
|
|
11
11
|
* Reference: https://en.wikipedia.org/wiki/Central_limit_theorem
|
|
@@ -10,7 +10,7 @@ import type { IRandom } from "../api.js";
|
|
|
10
10
|
* Reference: https://en.wikipedia.org/wiki/Geometric_distribution
|
|
11
11
|
*
|
|
12
12
|
* @param rnd -
|
|
13
|
-
* @param p - probability (0,1]
|
|
13
|
+
* @param p - probability `(0,1]`
|
|
14
14
|
*/
|
|
15
15
|
export declare const geometric: (rnd?: IRandom, p?: number) => () => number;
|
|
16
16
|
//# sourceMappingURL=geometric.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/random",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.11",
|
|
4
4
|
"description": "Pseudo-random number generators w/ unified API, distributions, weighted choices, ID generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@thi.ng/api": "^8.11.
|
|
43
|
-
"@thi.ng/errors": "^2.5.
|
|
42
|
+
"@thi.ng/api": "^8.11.20",
|
|
43
|
+
"@thi.ng/errors": "^2.5.26"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"esbuild": "^0.
|
|
47
|
-
"typedoc": "^0.27.
|
|
46
|
+
"esbuild": "^0.25.0",
|
|
47
|
+
"typedoc": "^0.27.7",
|
|
48
48
|
"typescript": "^5.7.3"
|
|
49
49
|
},
|
|
50
50
|
"keywords": [
|
|
@@ -159,5 +159,5 @@
|
|
|
159
159
|
"ksuid"
|
|
160
160
|
]
|
|
161
161
|
},
|
|
162
|
-
"gitHead": "
|
|
162
|
+
"gitHead": "9a0b33253fef092aaf301decf6ecd54317874d4c\n"
|
|
163
163
|
}
|
package/sfc32.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ import { ARandom } from "./arandom.js";
|
|
|
5
5
|
* Simple Fast Counter PRNG (32bit version)
|
|
6
6
|
*
|
|
7
7
|
* @remarks
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Reference:
|
|
9
|
+
* http://pracrand.sourceforge.net/
|
|
10
10
|
*/
|
|
11
11
|
export declare class SFC32 extends ARandom implements IBuffered<Uint32Array>, ICopy<SFC32>, ISeedable<ArrayLike<number>> {
|
|
12
12
|
buffer: Uint32Array;
|
package/smush32.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { FnN } from "@thi.ng/api";
|
|
|
2
2
|
import type { IRandom } from "./api.js";
|
|
3
3
|
/**
|
|
4
4
|
* Takes a `weight` function and optional {@link IRandom} instance (default:
|
|
5
|
-
* {@link SYSTEM}). The weight function accepts a number in [0,1) interval and
|
|
6
|
-
* returns a number in [0,1]
|
|
5
|
+
* {@link SYSTEM}). The weight function accepts a number in `[0,1)` interval and
|
|
6
|
+
* returns a number in `[0,1]`. Draws two random numbers `a` and `b` via
|
|
7
7
|
* {@link IRandom.float} and returns a tuple of `[a, b < weight(a)]`.
|
|
8
8
|
*
|
|
9
9
|
* @example
|