bias-random 1.0.1 → 1.0.3
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 +12 -0
- package/dist/index.d.cts +12 -8
- package/dist/index.d.ts +12 -8
- package/package.json +28 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# bias-random
|
|
2
2
|
|
|
3
|
+
## 1.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 27a324a: Imporved import support with explicit package export types
|
|
8
|
+
|
|
9
|
+
## 1.0.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- c3d3e31: Clarified documentation for the function, with clearer parameter explanations and a return as well as throws documentation
|
|
14
|
+
|
|
3
15
|
## 1.0.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.cts
CHANGED
|
@@ -5,15 +5,19 @@ interface BiasedRandomOptions {
|
|
|
5
5
|
max?: number;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
-
* Generates a random number
|
|
8
|
+
* Generates a random number between `min` and `max`, with an optional bias towards the lower or upper bound.
|
|
9
9
|
*
|
|
10
|
-
* @param
|
|
11
|
-
*
|
|
12
|
-
* @param biasLevel
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* @
|
|
10
|
+
* @param {Object} [options] - Optional configuration object to adjust the behavior of the random number generation.
|
|
11
|
+
* @param {boolean} [options.upperBias=false] - If true, biases the result towards the higher bound (`max`), otherwise biases towards the lower bound (`min`). Default is `false`.
|
|
12
|
+
* @param {number} [options.biasLevel=2] - Determines the strength of the bias. Must be 1 or greater, where `1` means no bias and higher values increase the bias. Default is `2`.
|
|
13
|
+
* @param {number} [options.min=0] - The minimum value for the random number range. Default is `0`.
|
|
14
|
+
* @param {number} [options.max=1] - The maximum value for the random number range. Default is `1`.
|
|
15
|
+
*
|
|
16
|
+
* @returns {number} A random number between `min` and `max`, optionally biased based on the provided options.
|
|
17
|
+
*
|
|
18
|
+
* @throws {TypeError} If `biasLevel` is not a number or is less than 1.
|
|
19
|
+
* @throws {TypeError} If `min` is not less than `max`, or if either `min` or `max` is not a number.
|
|
20
|
+
* @throws {TypeError} If `upperBias` is not a boolean.
|
|
17
21
|
*/
|
|
18
22
|
declare const biasedRandom: ({ upperBias, biasLevel, min, max }?: BiasedRandomOptions) => number;
|
|
19
23
|
|
package/dist/index.d.ts
CHANGED
|
@@ -5,15 +5,19 @@ interface BiasedRandomOptions {
|
|
|
5
5
|
max?: number;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
-
* Generates a random number
|
|
8
|
+
* Generates a random number between `min` and `max`, with an optional bias towards the lower or upper bound.
|
|
9
9
|
*
|
|
10
|
-
* @param
|
|
11
|
-
*
|
|
12
|
-
* @param biasLevel
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* @
|
|
10
|
+
* @param {Object} [options] - Optional configuration object to adjust the behavior of the random number generation.
|
|
11
|
+
* @param {boolean} [options.upperBias=false] - If true, biases the result towards the higher bound (`max`), otherwise biases towards the lower bound (`min`). Default is `false`.
|
|
12
|
+
* @param {number} [options.biasLevel=2] - Determines the strength of the bias. Must be 1 or greater, where `1` means no bias and higher values increase the bias. Default is `2`.
|
|
13
|
+
* @param {number} [options.min=0] - The minimum value for the random number range. Default is `0`.
|
|
14
|
+
* @param {number} [options.max=1] - The maximum value for the random number range. Default is `1`.
|
|
15
|
+
*
|
|
16
|
+
* @returns {number} A random number between `min` and `max`, optionally biased based on the provided options.
|
|
17
|
+
*
|
|
18
|
+
* @throws {TypeError} If `biasLevel` is not a number or is less than 1.
|
|
19
|
+
* @throws {TypeError} If `min` is not less than `max`, or if either `min` or `max` is not a number.
|
|
20
|
+
* @throws {TypeError} If `upperBias` is not a boolean.
|
|
17
21
|
*/
|
|
18
22
|
declare const biasedRandom: ({ upperBias, biasLevel, min, max }?: BiasedRandomOptions) => number;
|
|
19
23
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bias-random",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Generates biased random numbers with a customizable bias level, direction, and range",
|
|
5
5
|
"author": "Reid Moffat <reid.moffat9@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,19 +25,36 @@
|
|
|
25
25
|
"skewed-distribution"
|
|
26
26
|
],
|
|
27
27
|
"type": "module",
|
|
28
|
-
"main": "dist/index.
|
|
29
|
-
"module": "dist/index.
|
|
28
|
+
"main": "dist/index.cjs",
|
|
29
|
+
"module": "dist/index.js",
|
|
30
30
|
"types": "dist/index.d.ts",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"import": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"default": "./dist/index.js"
|
|
37
|
+
},
|
|
38
|
+
"require": {
|
|
39
|
+
"types": "./dist/index.d.cts",
|
|
40
|
+
"default": "./dist/index.cjs"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
31
44
|
"scripts": {
|
|
32
45
|
"lint": "tsc",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
46
|
+
"build": "tsup src/index.ts --format cjs,esm --dts --minify --clean",
|
|
47
|
+
"test": "pnpm run build && pnpm run loadTS && mocha",
|
|
35
48
|
"deployHelp": "echo 1) Run 'changeset' 2) Merge changes to main 3) Merge changeset PR 4) npm run deploy (verify it looks good)",
|
|
36
|
-
"deploy": "git checkout main && git pull && npm run build && npm publish"
|
|
49
|
+
"deploy": "git checkout main && git pull && npm run build && npm publish",
|
|
50
|
+
"loadTS": "cross-env TS_NODE_PROJECT='./tsconfig.json'"
|
|
37
51
|
},
|
|
38
52
|
"files": [
|
|
53
|
+
"dist",
|
|
39
54
|
"CHANGELOG.md",
|
|
40
|
-
"
|
|
55
|
+
"LICENSE",
|
|
56
|
+
"README.md",
|
|
57
|
+
"package.json"
|
|
41
58
|
],
|
|
42
59
|
"repository": {
|
|
43
60
|
"type": "git",
|
|
@@ -54,8 +71,10 @@
|
|
|
54
71
|
"generate-arrays": "^2.0.0",
|
|
55
72
|
"mocha": "^10.7.3",
|
|
56
73
|
"suite-metrics": "^1.3.1",
|
|
74
|
+
"test-inputs": "^1.3.0",
|
|
57
75
|
"ts-node": "^10.9.2",
|
|
58
|
-
"tsup": "^8.
|
|
76
|
+
"tsup": "^8.5.0",
|
|
59
77
|
"typescript": "^5.6.2"
|
|
60
|
-
}
|
|
78
|
+
},
|
|
79
|
+
"packageManager": "pnpm@10.18.3"
|
|
61
80
|
}
|