extra-rand 0.1.1 → 0.1.2

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.
Files changed (55) hide show
  1. package/README.md +24 -8
  2. package/lib/{es2015/index.d.ts → index.d.ts} +2 -0
  3. package/lib/{es2015/index.js → index.js} +7 -1
  4. package/lib/index.js.map +1 -0
  5. package/lib/map-to-int-range.d.ts +1 -0
  6. package/lib/map-to-int-range.js +9 -0
  7. package/lib/map-to-int-range.js.map +1 -0
  8. package/lib/map-to-range.d.ts +1 -0
  9. package/lib/map-to-range.js +10 -0
  10. package/lib/map-to-range.js.map +1 -0
  11. package/lib/random-int-inclusive.js +9 -0
  12. package/lib/random-int-inclusive.js.map +1 -0
  13. package/lib/random-int.js +9 -0
  14. package/lib/random-int.js.map +1 -0
  15. package/lib/random.js +9 -0
  16. package/lib/random.js.map +1 -0
  17. package/package.json +22 -38
  18. package/dist/es2015/index.min.mjs +0 -2
  19. package/dist/es2015/index.min.mjs.map +0 -1
  20. package/dist/es2015/index.mjs +0 -18
  21. package/dist/es2015/index.mjs.map +0 -1
  22. package/dist/es2015/index.umd.js +0 -30
  23. package/dist/es2015/index.umd.js.map +0 -1
  24. package/dist/es2015/index.umd.min.js +0 -2
  25. package/dist/es2015/index.umd.min.js.map +0 -1
  26. package/dist/es2018/index.min.mjs +0 -2
  27. package/dist/es2018/index.min.mjs.map +0 -1
  28. package/dist/es2018/index.mjs +0 -18
  29. package/dist/es2018/index.mjs.map +0 -1
  30. package/dist/es2018/index.umd.js +0 -30
  31. package/dist/es2018/index.umd.js.map +0 -1
  32. package/dist/es2018/index.umd.min.js +0 -2
  33. package/dist/es2018/index.umd.min.js.map +0 -1
  34. package/lib/es2015/index.js.map +0 -1
  35. package/lib/es2015/random-int-inclusive.js +0 -10
  36. package/lib/es2015/random-int-inclusive.js.map +0 -1
  37. package/lib/es2015/random-int.js +0 -10
  38. package/lib/es2015/random-int.js.map +0 -1
  39. package/lib/es2015/random.js +0 -8
  40. package/lib/es2015/random.js.map +0 -1
  41. package/lib/es2018/index.d.ts +0 -3
  42. package/lib/es2018/index.js +0 -16
  43. package/lib/es2018/index.js.map +0 -1
  44. package/lib/es2018/random-int-inclusive.d.ts +0 -1
  45. package/lib/es2018/random-int-inclusive.js +0 -10
  46. package/lib/es2018/random-int-inclusive.js.map +0 -1
  47. package/lib/es2018/random-int.d.ts +0 -1
  48. package/lib/es2018/random-int.js +0 -10
  49. package/lib/es2018/random-int.js.map +0 -1
  50. package/lib/es2018/random.d.ts +0 -1
  51. package/lib/es2018/random.js +0 -8
  52. package/lib/es2018/random.js.map +0 -1
  53. /package/lib/{es2015/random-int-inclusive.d.ts → random-int-inclusive.d.ts} +0 -0
  54. /package/lib/{es2015/random-int.d.ts → random-int.d.ts} +0 -0
  55. /package/lib/{es2015/random.d.ts → random.d.ts} +0 -0
package/README.md CHANGED
@@ -2,7 +2,6 @@
2
2
  Yet another random library.
3
3
 
4
4
  ## Install
5
-
6
5
  ```sh
7
6
  npm install --save extra-rand
8
7
  # or
@@ -10,27 +9,44 @@ yarn add extra-rand
10
9
  ```
11
10
 
12
11
  ## API
13
-
14
12
  ### random
15
-
16
13
  ```ts
17
14
  function random(min: number, max: number): number
18
15
  ```
19
16
 
20
- Return a number in the range `[min, max)`.
17
+ The function returns a number in the range `[min, max)`.
21
18
 
22
19
  ### randomInt
23
-
24
20
  ```ts
25
21
  function randomInt(min: number, max: number): number
26
22
  ```
27
23
 
28
- Return an integer in the range `[Math.ceil(min), Math.floor(max))`.
24
+ The function returns an integer in the range `[Math.ceil(min), Math.floor(max))`.
29
25
 
30
26
  ### randomIntInclusive
31
-
32
27
  ```ts
33
28
  function randomIntInclusive(min: number, max: number): number
34
29
  ```
35
30
 
36
- Return an integer in the range `[Math.ceil(min), Math.floor(max)]`.
31
+ The function returns an integer in the range `[Math.ceil(min), Math.floor(max)]`.
32
+
33
+ ### Linear Map
34
+ These low-level methods help you to use random number generators other than `Math.random()`.
35
+
36
+ #### mapToRange
37
+ ```ts
38
+ function mapToRange(
39
+ value: number
40
+ , oldMin: number, oldMax: number
41
+ , newMin: number, newMax: number
42
+ ): number
43
+ ```
44
+
45
+ #### mapToIntRange
46
+ ```ts
47
+ function mapToIntRange(
48
+ value: number
49
+ , oldMin: number, oldMax: number
50
+ , newMin: number, newMax: number
51
+ ): number
52
+ ```
@@ -1,3 +1,5 @@
1
1
  export * from './random';
2
2
  export * from './random-int';
3
3
  export * from './random-int-inclusive';
4
+ export * from './map-to-range';
5
+ export * from './map-to-int-range';
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -13,4 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
17
  __exportStar(require("./random"), exports);
14
18
  __exportStar(require("./random-int"), exports);
15
19
  __exportStar(require("./random-int-inclusive"), exports);
20
+ __exportStar(require("./map-to-range"), exports);
21
+ __exportStar(require("./map-to-int-range"), exports);
16
22
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,+CAA4B;AAC5B,yDAAsC;AAEtC,iDAA8B;AAC9B,qDAAkC"}
@@ -0,0 +1 @@
1
+ export declare function mapToIntRange(value: number, oldMin: number, oldMax: number, newMin: number, newMax: number): number;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapToIntRange = void 0;
4
+ const map_to_range_1 = require("./map-to-range");
5
+ function mapToIntRange(value, oldMin, oldMax, newMin, newMax) {
6
+ return Math.floor((0, map_to_range_1.mapToRange)(value, oldMin, oldMax, newMin, newMax));
7
+ }
8
+ exports.mapToIntRange = mapToIntRange;
9
+ //# sourceMappingURL=map-to-int-range.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map-to-int-range.js","sourceRoot":"","sources":["../src/map-to-int-range.ts"],"names":[],"mappings":";;;AAAA,iDAA2C;AAE3C,SAAgB,aAAa,CAC3B,KAAa,EACb,MAAc,EAAE,MAAc,EAC9B,MAAc,EAAE,MAAc;IAE9B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAA,yBAAU,EAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;AACtE,CAAC;AAND,sCAMC"}
@@ -0,0 +1 @@
1
+ export declare function mapToRange(value: number, oldMin: number, oldMax: number, newMin: number, newMax: number): number;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapToRange = void 0;
4
+ function mapToRange(value, oldMin, oldMax, newMin, newMax) {
5
+ return (value - oldMin) / (oldMax - oldMin)
6
+ * (newMax - newMin)
7
+ + newMin;
8
+ }
9
+ exports.mapToRange = mapToRange;
10
+ //# sourceMappingURL=map-to-range.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map-to-range.js","sourceRoot":"","sources":["../src/map-to-range.ts"],"names":[],"mappings":";;;AAAA,SAAgB,UAAU,CACxB,KAAa,EACb,MAAc,EAAE,MAAc,EAC9B,MAAc,EAAE,MAAc;IAE9B,OAAO,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC;UACpC,CAAC,MAAM,GAAG,MAAM,CAAC;UACjB,MAAM,CAAA;AACf,CAAC;AARD,gCAQC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.randomIntInclusive = void 0;
4
+ const map_to_int_range_1 = require("./map-to-int-range");
5
+ function randomIntInclusive(min, max) {
6
+ return (0, map_to_int_range_1.mapToIntRange)(Math.random(), 0, 1, Math.ceil(min), Math.floor(max) + 1);
7
+ }
8
+ exports.randomIntInclusive = randomIntInclusive;
9
+ //# sourceMappingURL=random-int-inclusive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"random-int-inclusive.js","sourceRoot":"","sources":["../src/random-int-inclusive.ts"],"names":[],"mappings":";;;AAAA,yDAAkD;AAElD,SAAgB,kBAAkB,CAAC,GAAW,EAAE,GAAW;IACzD,OAAO,IAAA,gCAAa,EAClB,IAAI,CAAC,MAAM,EAAE,EACb,CAAC,EAAE,CAAC,EACJ,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CACpC,CAAA;AACH,CAAC;AAND,gDAMC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.randomInt = void 0;
4
+ const map_to_int_range_1 = require("./map-to-int-range");
5
+ function randomInt(min, max) {
6
+ return (0, map_to_int_range_1.mapToIntRange)(Math.random(), 0, 1, Math.ceil(min), Math.floor(max));
7
+ }
8
+ exports.randomInt = randomInt;
9
+ //# sourceMappingURL=random-int.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"random-int.js","sourceRoot":"","sources":["../src/random-int.ts"],"names":[],"mappings":";;;AAAA,yDAAkD;AAElD,SAAgB,SAAS,CAAC,GAAW,EAAE,GAAW;IAChD,OAAO,IAAA,gCAAa,EAClB,IAAI,CAAC,MAAM,EAAE,EACb,CAAC,EAAE,CAAC,EACJ,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAChC,CAAA;AACH,CAAC;AAND,8BAMC"}
package/lib/random.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.random = void 0;
4
+ const map_to_range_1 = require("./map-to-range");
5
+ function random(min, max) {
6
+ return (0, map_to_range_1.mapToRange)(Math.random(), 0, 1, min, max);
7
+ }
8
+ exports.random = random;
9
+ //# sourceMappingURL=random.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"random.js","sourceRoot":"","sources":["../src/random.ts"],"names":[],"mappings":";;;AAAA,iDAA2C;AAE3C,SAAgB,MAAM,CAAC,GAAW,EAAE,GAAW;IAC7C,OAAO,IAAA,yBAAU,EACf,IAAI,CAAC,MAAM,EAAE,EACb,CAAC,EAAE,CAAC,EACJ,GAAG,EAAE,GAAG,CACT,CAAA;AACH,CAAC;AAND,wBAMC"}
package/package.json CHANGED
@@ -1,16 +1,15 @@
1
1
  {
2
2
  "name": "extra-rand",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Yet another random library",
5
5
  "keywords": [
6
6
  "random"
7
7
  ],
8
8
  "files": [
9
- "lib",
10
- "dist"
9
+ "lib"
11
10
  ],
12
- "main": "lib/es2018/index.js",
13
- "types": "lib/es2018/index.d.ts",
11
+ "main": "lib/index.js",
12
+ "types": "lib/index.d.ts",
14
13
  "sideEffects": false,
15
14
  "repository": "git@github.com:BlackGlory/extra-rand.git",
16
15
  "author": "BlackGlory <woshenmedoubuzhidao@blackglory.me>",
@@ -20,51 +19,36 @@
20
19
  "test": "jest --config jest.config.js",
21
20
  "test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
22
21
  "test:coverage": "jest --coverage --config jest.config.js",
23
- "prepublishOnly": "run-s clean build bundle",
24
- "clean": "run-p clean:*",
25
- "clean:build": "rimraf lib",
26
- "clean:bundle": "rimraf dist",
27
- "build": "run-p build:*",
28
- "build:es2015": "run-s build:es2015:*",
29
- "build:es2015:compile": "tsc --project tsconfig.build.json --module commonjs --target es2015 --outDir lib/es2015",
30
- "build:es2015:patch": "tscpaths -p tsconfig.build.json -s ./src -o ./lib/es2015",
31
- "build:es2018": "run-s build:es2018:*",
32
- "build:es2018:compile": "tsc --project tsconfig.build.json --module commonjs --target es2018 --outDir lib/es2018",
33
- "build:es2018:patch": "tscpaths -p tsconfig.build.json -s ./src -o ./lib/es2018",
34
- "bundle": "rollup --config rollup.config.js",
22
+ "prepublishOnly": "run-s clean build",
23
+ "clean": "rimraf lib",
24
+ "build": "run-s build:*",
25
+ "build:compile": "tsc --project tsconfig.build.json --module commonjs --target es2018 --outDir lib",
26
+ "build:patch": "tscpaths -p tsconfig.build.json -s ./src -o ./lib",
35
27
  "release": "standard-version"
36
28
  },
37
29
  "husky": {
38
30
  "hooks": {
39
- "pre-commit": "run-s lint test",
31
+ "pre-commit": "run-s lint build test",
40
32
  "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
41
33
  }
42
34
  },
43
35
  "devDependencies": {
44
- "@commitlint/cli": "^16.0.1",
45
- "@commitlint/config-conventional": "^16.0.0",
46
- "@rollup/plugin-commonjs": "^21.0.1",
47
- "@rollup/plugin-json": "^4.1.0",
48
- "@rollup/plugin-node-resolve": "^13.1.3",
49
- "@rollup/plugin-replace": "^3.0.1",
50
- "@rollup/plugin-typescript": "^8.2.0",
51
- "@types/jest": "^27.4.0",
52
- "@typescript-eslint/eslint-plugin": "^5.9.0",
53
- "@typescript-eslint/parser": "^5.9.0",
54
- "eslint": "^8.6.0",
55
- "extra-generator": "^0.2.15",
36
+ "@commitlint/cli": "^17.5.1",
37
+ "@commitlint/config-conventional": "^17.4.4",
38
+ "@types/jest": "^29.5.0",
39
+ "@typescript-eslint/eslint-plugin": "^5.57.0",
40
+ "@typescript-eslint/parser": "^5.57.0",
41
+ "eslint": "^8.37.0",
42
+ "extra-generator": "^0.2.17",
56
43
  "husky": "^4.3.8",
57
- "jest": "^27.4.7",
44
+ "jest": "^29.5.0",
58
45
  "npm-run-all": "^4.1.5",
59
46
  "rimraf": "^3.0.2",
60
- "rollup": "^2.63.0",
61
- "rollup-plugin-analyzer": "^4.0.0",
62
- "rollup-plugin-terser": "^7.0.2",
63
- "standard-version": "^9.1.1",
64
- "ts-jest": "^27.1.2",
47
+ "standard-version": "^9.5.0",
48
+ "ts-jest": "^29.0.5",
65
49
  "tscpaths": "^0.0.9",
66
- "tslib": "^2.3.1",
67
- "typescript": "^4.5.4"
50
+ "tslib": "^2.5.0",
51
+ "typescript": "^4.7.4"
68
52
  },
69
53
  "dependencies": {}
70
54
  }
@@ -1,2 +0,0 @@
1
- function t(t,o){return Math.random()*(o-t)+t}function o(t,o){return t=Math.ceil(t),o=Math.floor(o),Math.floor(Math.random()*(o-t))+t}function r(t,o){return t=Math.ceil(t),o=Math.floor(o),Math.floor(Math.random()*(o-t+1))+t}export{t as random,o as randomInt,r as randomIntInclusive};
2
- //# sourceMappingURL=index.min.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.min.mjs","sources":["../../src/random.ts","../../src/random-int.ts","../../src/random-int-inclusive.ts"],"sourcesContent":["export function random(min: number, max: number): number {\n return Math.random() * (max - min) + min\n}\n","export function randomInt(min: number, max: number): number {\n min = Math.ceil(min)\n max = Math.floor(max)\n return Math.floor(Math.random() * (max - min)) + min\n}\n","export function randomIntInclusive(min: number, max: number): number {\n min = Math.ceil(min)\n max = Math.floor(max)\n return Math.floor(Math.random() * (max - min + 1)) + min\n}\n"],"names":["random","min","max","Math","randomInt","ceil","floor","randomIntInclusive"],"mappings":"SAAgBA,EAAOC,EAAaC,GAClC,OAAOC,KAAKH,UAAYE,EAAMD,GAAOA,WCDvBG,EAAUH,EAAaC,GAGrC,OAFAD,EAAME,KAAKE,KAAKJ,GAChBC,EAAMC,KAAKG,MAAMJ,GACVC,KAAKG,MAAMH,KAAKH,UAAYE,EAAMD,IAAQA,WCHnCM,EAAmBN,EAAaC,GAG9C,OAFAD,EAAME,KAAKE,KAAKJ,GAChBC,EAAMC,KAAKG,MAAMJ,GACVC,KAAKG,MAAMH,KAAKH,UAAYE,EAAMD,EAAM,IAAMA"}
@@ -1,18 +0,0 @@
1
- function random(min, max) {
2
- return Math.random() * (max - min) + min;
3
- }
4
-
5
- function randomInt(min, max) {
6
- min = Math.ceil(min);
7
- max = Math.floor(max);
8
- return Math.floor(Math.random() * (max - min)) + min;
9
- }
10
-
11
- function randomIntInclusive(min, max) {
12
- min = Math.ceil(min);
13
- max = Math.floor(max);
14
- return Math.floor(Math.random() * (max - min + 1)) + min;
15
- }
16
-
17
- export { random, randomInt, randomIntInclusive };
18
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/random.ts","../../src/random-int.ts","../../src/random-int-inclusive.ts"],"sourcesContent":["export function random(min: number, max: number): number {\n return Math.random() * (max - min) + min\n}\n","export function randomInt(min: number, max: number): number {\n min = Math.ceil(min)\n max = Math.floor(max)\n return Math.floor(Math.random() * (max - min)) + min\n}\n","export function randomIntInclusive(min: number, max: number): number {\n min = Math.ceil(min)\n max = Math.floor(max)\n return Math.floor(Math.random() * (max - min + 1)) + min\n}\n"],"names":[],"mappings":"SAAgB,MAAM,CAAC,GAAW,EAAE,GAAW;IAC7C,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAA;AAC1C;;SCFgB,SAAS,CAAC,GAAW,EAAE,GAAW;IAChD,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACpB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACrB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAA;AACtD;;SCJgB,kBAAkB,CAAC,GAAW,EAAE,GAAW;IACzD,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACpB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACrB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAA;AAC1D;;;;"}
@@ -1,30 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ExtraRand = {}));
5
- })(this, (function (exports) { 'use strict';
6
-
7
- function random(min, max) {
8
- return Math.random() * (max - min) + min;
9
- }
10
-
11
- function randomInt(min, max) {
12
- min = Math.ceil(min);
13
- max = Math.floor(max);
14
- return Math.floor(Math.random() * (max - min)) + min;
15
- }
16
-
17
- function randomIntInclusive(min, max) {
18
- min = Math.ceil(min);
19
- max = Math.floor(max);
20
- return Math.floor(Math.random() * (max - min + 1)) + min;
21
- }
22
-
23
- exports.random = random;
24
- exports.randomInt = randomInt;
25
- exports.randomIntInclusive = randomIntInclusive;
26
-
27
- Object.defineProperty(exports, '__esModule', { value: true });
28
-
29
- }));
30
- //# sourceMappingURL=index.umd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.umd.js","sources":["../../src/random.ts","../../src/random-int.ts","../../src/random-int-inclusive.ts"],"sourcesContent":["export function random(min: number, max: number): number {\n return Math.random() * (max - min) + min\n}\n","export function randomInt(min: number, max: number): number {\n min = Math.ceil(min)\n max = Math.floor(max)\n return Math.floor(Math.random() * (max - min)) + min\n}\n","export function randomIntInclusive(min: number, max: number): number {\n min = Math.ceil(min)\n max = Math.floor(max)\n return Math.floor(Math.random() * (max - min + 1)) + min\n}\n"],"names":[],"mappings":";;;;;;aAAgB,MAAM,CAAC,GAAW,EAAE,GAAW;QAC7C,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAA;IAC1C;;aCFgB,SAAS,CAAC,GAAW,EAAE,GAAW;QAChD,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACpB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACrB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAA;IACtD;;aCJgB,kBAAkB,CAAC,GAAW,EAAE,GAAW;QACzD,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACpB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACrB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAA;IAC1D;;;;;;;;;;;;"}
@@ -1,2 +0,0 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ExtraRand={})}(this,(function(e){"use strict";e.random=function(e,t){return Math.random()*(t-e)+e},e.randomInt=function(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e))+e},e.randomIntInclusive=function(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e},Object.defineProperty(e,"__esModule",{value:!0})}));
2
- //# sourceMappingURL=index.umd.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.umd.min.js","sources":["../../src/random.ts","../../src/random-int.ts","../../src/random-int-inclusive.ts"],"sourcesContent":["export function random(min: number, max: number): number {\n return Math.random() * (max - min) + min\n}\n","export function randomInt(min: number, max: number): number {\n min = Math.ceil(min)\n max = Math.floor(max)\n return Math.floor(Math.random() * (max - min)) + min\n}\n","export function randomIntInclusive(min: number, max: number): number {\n min = Math.ceil(min)\n max = Math.floor(max)\n return Math.floor(Math.random() * (max - min + 1)) + min\n}\n"],"names":["min","max","Math","random","ceil","floor"],"mappings":"mQAAuBA,EAAaC,GAClC,OAAOC,KAAKC,UAAYF,EAAMD,GAAOA,wBCDbA,EAAaC,GAGrC,OAFAD,EAAME,KAAKE,KAAKJ,GAChBC,EAAMC,KAAKG,MAAMJ,GACVC,KAAKG,MAAMH,KAAKC,UAAYF,EAAMD,IAAQA,iCCHhBA,EAAaC,GAG9C,OAFAD,EAAME,KAAKE,KAAKJ,GAChBC,EAAMC,KAAKG,MAAMJ,GACVC,KAAKG,MAAMH,KAAKC,UAAYF,EAAMD,EAAM,IAAMA"}
@@ -1,2 +0,0 @@
1
- function t(t,o){return Math.random()*(o-t)+t}function o(t,o){return t=Math.ceil(t),o=Math.floor(o),Math.floor(Math.random()*(o-t))+t}function r(t,o){return t=Math.ceil(t),o=Math.floor(o),Math.floor(Math.random()*(o-t+1))+t}export{t as random,o as randomInt,r as randomIntInclusive};
2
- //# sourceMappingURL=index.min.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.min.mjs","sources":["../../src/random.ts","../../src/random-int.ts","../../src/random-int-inclusive.ts"],"sourcesContent":["export function random(min: number, max: number): number {\n return Math.random() * (max - min) + min\n}\n","export function randomInt(min: number, max: number): number {\n min = Math.ceil(min)\n max = Math.floor(max)\n return Math.floor(Math.random() * (max - min)) + min\n}\n","export function randomIntInclusive(min: number, max: number): number {\n min = Math.ceil(min)\n max = Math.floor(max)\n return Math.floor(Math.random() * (max - min + 1)) + min\n}\n"],"names":["random","min","max","Math","randomInt","ceil","floor","randomIntInclusive"],"mappings":"SAAgBA,EAAOC,EAAaC,GAClC,OAAOC,KAAKH,UAAYE,EAAMD,GAAOA,WCDvBG,EAAUH,EAAaC,GAGrC,OAFAD,EAAME,KAAKE,KAAKJ,GAChBC,EAAMC,KAAKG,MAAMJ,GACVC,KAAKG,MAAMH,KAAKH,UAAYE,EAAMD,IAAQA,WCHnCM,EAAmBN,EAAaC,GAG9C,OAFAD,EAAME,KAAKE,KAAKJ,GAChBC,EAAMC,KAAKG,MAAMJ,GACVC,KAAKG,MAAMH,KAAKH,UAAYE,EAAMD,EAAM,IAAMA"}
@@ -1,18 +0,0 @@
1
- function random(min, max) {
2
- return Math.random() * (max - min) + min;
3
- }
4
-
5
- function randomInt(min, max) {
6
- min = Math.ceil(min);
7
- max = Math.floor(max);
8
- return Math.floor(Math.random() * (max - min)) + min;
9
- }
10
-
11
- function randomIntInclusive(min, max) {
12
- min = Math.ceil(min);
13
- max = Math.floor(max);
14
- return Math.floor(Math.random() * (max - min + 1)) + min;
15
- }
16
-
17
- export { random, randomInt, randomIntInclusive };
18
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/random.ts","../../src/random-int.ts","../../src/random-int-inclusive.ts"],"sourcesContent":["export function random(min: number, max: number): number {\n return Math.random() * (max - min) + min\n}\n","export function randomInt(min: number, max: number): number {\n min = Math.ceil(min)\n max = Math.floor(max)\n return Math.floor(Math.random() * (max - min)) + min\n}\n","export function randomIntInclusive(min: number, max: number): number {\n min = Math.ceil(min)\n max = Math.floor(max)\n return Math.floor(Math.random() * (max - min + 1)) + min\n}\n"],"names":[],"mappings":"SAAgB,MAAM,CAAC,GAAW,EAAE,GAAW;IAC7C,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAA;AAC1C;;SCFgB,SAAS,CAAC,GAAW,EAAE,GAAW;IAChD,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACpB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACrB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAA;AACtD;;SCJgB,kBAAkB,CAAC,GAAW,EAAE,GAAW;IACzD,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACpB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACrB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAA;AAC1D;;;;"}
@@ -1,30 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ExtraRand = {}));
5
- })(this, (function (exports) { 'use strict';
6
-
7
- function random(min, max) {
8
- return Math.random() * (max - min) + min;
9
- }
10
-
11
- function randomInt(min, max) {
12
- min = Math.ceil(min);
13
- max = Math.floor(max);
14
- return Math.floor(Math.random() * (max - min)) + min;
15
- }
16
-
17
- function randomIntInclusive(min, max) {
18
- min = Math.ceil(min);
19
- max = Math.floor(max);
20
- return Math.floor(Math.random() * (max - min + 1)) + min;
21
- }
22
-
23
- exports.random = random;
24
- exports.randomInt = randomInt;
25
- exports.randomIntInclusive = randomIntInclusive;
26
-
27
- Object.defineProperty(exports, '__esModule', { value: true });
28
-
29
- }));
30
- //# sourceMappingURL=index.umd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.umd.js","sources":["../../src/random.ts","../../src/random-int.ts","../../src/random-int-inclusive.ts"],"sourcesContent":["export function random(min: number, max: number): number {\n return Math.random() * (max - min) + min\n}\n","export function randomInt(min: number, max: number): number {\n min = Math.ceil(min)\n max = Math.floor(max)\n return Math.floor(Math.random() * (max - min)) + min\n}\n","export function randomIntInclusive(min: number, max: number): number {\n min = Math.ceil(min)\n max = Math.floor(max)\n return Math.floor(Math.random() * (max - min + 1)) + min\n}\n"],"names":[],"mappings":";;;;;;aAAgB,MAAM,CAAC,GAAW,EAAE,GAAW;QAC7C,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAA;IAC1C;;aCFgB,SAAS,CAAC,GAAW,EAAE,GAAW;QAChD,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACpB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACrB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAA;IACtD;;aCJgB,kBAAkB,CAAC,GAAW,EAAE,GAAW;QACzD,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACpB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACrB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAA;IAC1D;;;;;;;;;;;;"}
@@ -1,2 +0,0 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ExtraRand={})}(this,(function(e){"use strict";e.random=function(e,t){return Math.random()*(t-e)+e},e.randomInt=function(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e))+e},e.randomIntInclusive=function(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e},Object.defineProperty(e,"__esModule",{value:!0})}));
2
- //# sourceMappingURL=index.umd.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.umd.min.js","sources":["../../src/random.ts","../../src/random-int.ts","../../src/random-int-inclusive.ts"],"sourcesContent":["export function random(min: number, max: number): number {\n return Math.random() * (max - min) + min\n}\n","export function randomInt(min: number, max: number): number {\n min = Math.ceil(min)\n max = Math.floor(max)\n return Math.floor(Math.random() * (max - min)) + min\n}\n","export function randomIntInclusive(min: number, max: number): number {\n min = Math.ceil(min)\n max = Math.floor(max)\n return Math.floor(Math.random() * (max - min + 1)) + min\n}\n"],"names":["min","max","Math","random","ceil","floor"],"mappings":"mQAAuBA,EAAaC,GAClC,OAAOC,KAAKC,UAAYF,EAAMD,GAAOA,wBCDbA,EAAaC,GAGrC,OAFAD,EAAME,KAAKE,KAAKJ,GAChBC,EAAMC,KAAKG,MAAMJ,GACVC,KAAKG,MAAMH,KAAKC,UAAYF,EAAMD,IAAQA,iCCHhBA,EAAaC,GAG9C,OAFAD,EAAME,KAAKE,KAAKJ,GAChBC,EAAMC,KAAKG,MAAMJ,GACVC,KAAKG,MAAMH,KAAKC,UAAYF,EAAMD,EAAM,IAAMA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwB;AACxB,+CAA4B;AAC5B,yDAAsC"}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.randomIntInclusive = void 0;
4
- function randomIntInclusive(min, max) {
5
- min = Math.ceil(min);
6
- max = Math.floor(max);
7
- return Math.floor(Math.random() * (max - min + 1)) + min;
8
- }
9
- exports.randomIntInclusive = randomIntInclusive;
10
- //# sourceMappingURL=random-int-inclusive.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"random-int-inclusive.js","sourceRoot":"","sources":["../../src/random-int-inclusive.ts"],"names":[],"mappings":";;;AAAA,SAAgB,kBAAkB,CAAC,GAAW,EAAE,GAAW;IACzD,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACpB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACrB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAA;AAC1D,CAAC;AAJD,gDAIC"}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.randomInt = void 0;
4
- function randomInt(min, max) {
5
- min = Math.ceil(min);
6
- max = Math.floor(max);
7
- return Math.floor(Math.random() * (max - min)) + min;
8
- }
9
- exports.randomInt = randomInt;
10
- //# sourceMappingURL=random-int.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"random-int.js","sourceRoot":"","sources":["../../src/random-int.ts"],"names":[],"mappings":";;;AAAA,SAAgB,SAAS,CAAC,GAAW,EAAE,GAAW;IAChD,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACpB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACrB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAA;AACtD,CAAC;AAJD,8BAIC"}
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.random = void 0;
4
- function random(min, max) {
5
- return Math.random() * (max - min) + min;
6
- }
7
- exports.random = random;
8
- //# sourceMappingURL=random.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"random.js","sourceRoot":"","sources":["../../src/random.ts"],"names":[],"mappings":";;;AAAA,SAAgB,MAAM,CAAC,GAAW,EAAE,GAAW;IAC7C,OAAO,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAA;AAC1C,CAAC;AAFD,wBAEC"}
@@ -1,3 +0,0 @@
1
- export * from './random';
2
- export * from './random-int';
3
- export * from './random-int-inclusive';
@@ -1,16 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./random"), exports);
14
- __exportStar(require("./random-int"), exports);
15
- __exportStar(require("./random-int-inclusive"), exports);
16
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwB;AACxB,+CAA4B;AAC5B,yDAAsC"}
@@ -1 +0,0 @@
1
- export declare function randomIntInclusive(min: number, max: number): number;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.randomIntInclusive = void 0;
4
- function randomIntInclusive(min, max) {
5
- min = Math.ceil(min);
6
- max = Math.floor(max);
7
- return Math.floor(Math.random() * (max - min + 1)) + min;
8
- }
9
- exports.randomIntInclusive = randomIntInclusive;
10
- //# sourceMappingURL=random-int-inclusive.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"random-int-inclusive.js","sourceRoot":"","sources":["../../src/random-int-inclusive.ts"],"names":[],"mappings":";;;AAAA,SAAgB,kBAAkB,CAAC,GAAW,EAAE,GAAW;IACzD,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACpB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACrB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAA;AAC1D,CAAC;AAJD,gDAIC"}
@@ -1 +0,0 @@
1
- export declare function randomInt(min: number, max: number): number;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.randomInt = void 0;
4
- function randomInt(min, max) {
5
- min = Math.ceil(min);
6
- max = Math.floor(max);
7
- return Math.floor(Math.random() * (max - min)) + min;
8
- }
9
- exports.randomInt = randomInt;
10
- //# sourceMappingURL=random-int.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"random-int.js","sourceRoot":"","sources":["../../src/random-int.ts"],"names":[],"mappings":";;;AAAA,SAAgB,SAAS,CAAC,GAAW,EAAE,GAAW;IAChD,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACpB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACrB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAA;AACtD,CAAC;AAJD,8BAIC"}
@@ -1 +0,0 @@
1
- export declare function random(min: number, max: number): number;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.random = void 0;
4
- function random(min, max) {
5
- return Math.random() * (max - min) + min;
6
- }
7
- exports.random = random;
8
- //# sourceMappingURL=random.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"random.js","sourceRoot":"","sources":["../../src/random.ts"],"names":[],"mappings":";;;AAAA,SAAgB,MAAM,CAAC,GAAW,EAAE,GAAW;IAC7C,OAAO,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAA;AAC1C,CAAC;AAFD,wBAEC"}
File without changes
File without changes