@hyperfrontend/random-generator-utils
Advanced tools
| 'use strict'; | ||
| const _Error = globalThis.Error; | ||
| const _Reflect = globalThis.Reflect; | ||
| const createError = (message, options) => _Reflect.construct(_Error, [message, options]); | ||
| exports.createError = createError; |
| const _Error = globalThis.Error; | ||
| const _Reflect = globalThis.Reflect; | ||
| const createError = (message, options) => _Reflect.construct(_Error, [message, options]); | ||
| export { createError }; |
| 'use strict'; | ||
| const _Math = globalThis.Math; | ||
| const floor = _Math.floor; | ||
| const pow = _Math.pow; | ||
| const sqrt = _Math.sqrt; | ||
| const exp = _Math.exp; | ||
| const log = _Math.log; | ||
| const sin = _Math.sin; | ||
| const random = _Math.random; | ||
| exports.exp = exp; | ||
| exports.floor = floor; | ||
| exports.log = log; | ||
| exports.pow = pow; | ||
| exports.random = random; | ||
| exports.sin = sin; | ||
| exports.sqrt = sqrt; |
| const _Math = globalThis.Math; | ||
| const floor = _Math.floor; | ||
| const pow = _Math.pow; | ||
| const sqrt = _Math.sqrt; | ||
| const exp = _Math.exp; | ||
| const log = _Math.log; | ||
| const sin = _Math.sin; | ||
| const random = _Math.random; | ||
| export { exp, floor, log, pow, random, sin, sqrt }; |
+110
-18
@@ -12,3 +12,2 @@ var HyperfrontendRandomGenerator = (function (exports) { | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Math = globalThis.Math; | ||
@@ -19,5 +18,2 @@ /** | ||
| const floor = _Math.floor; | ||
| // ============================================================================ | ||
| // Powers and Roots | ||
| // ============================================================================ | ||
| /** | ||
@@ -35,5 +31,2 @@ * (Safe copy) Returns the base to the exponent power. | ||
| const exp = _Math.exp; | ||
| // ============================================================================ | ||
| // Logarithms | ||
| // ============================================================================ | ||
| /** | ||
@@ -43,5 +36,2 @@ * (Safe copy) Returns the natural logarithm of a number. | ||
| const log = _Math.log; | ||
| // ============================================================================ | ||
| // Trigonometry | ||
| // ============================================================================ | ||
| /** | ||
@@ -51,5 +41,2 @@ * (Safe copy) Returns the sine of a number. | ||
| const sin = _Math.sin; | ||
| // ============================================================================ | ||
| // Random | ||
| // ============================================================================ | ||
| /** | ||
@@ -67,2 +54,11 @@ * (Safe copy) Returns a pseudo-random number between 0 and 1. | ||
| * @returns A random number from the exponential distribution | ||
| * | ||
| * @example Modeling time between events (e.g., customer arrivals) | ||
| * ```typescript | ||
| * // Higher lambda = shorter average wait time | ||
| * const averageWaitMinutes = 5 | ||
| * const lambda = 1 / averageWaitMinutes | ||
| * const waitTime = randomExponential(lambda) | ||
| * // => 3.7 (varies each call, most values clustered near 0-10) | ||
| * ``` | ||
| */ | ||
@@ -85,3 +81,2 @@ function randomExponential(lambda) { | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Error = globalThis.Error; | ||
@@ -96,2 +91,9 @@ const _Reflect = globalThis.Reflect; | ||
| * @returns A new Error instance. | ||
| * | ||
| * @example Creating Error instances | ||
| * ```typescript | ||
| * const error = createError('Operation failed') | ||
| * // With cause for error chaining | ||
| * const wrapped = createError('Request failed', { cause: originalError }) | ||
| * ``` | ||
| */ | ||
@@ -106,2 +108,14 @@ const createError = (message, options) => _Reflect.construct(_Error, [message, options]); | ||
| * @returns A random number from the Gaussian distribution bounded by min and max | ||
| * | ||
| * @example Simulating human heights in centimeters | ||
| * ```typescript | ||
| * const heightCm = randomGaussian(150, 200) | ||
| * // => 174.3 (most values cluster around the midpoint 175) | ||
| * ``` | ||
| * | ||
| * @example Generating test scores with realistic distribution | ||
| * ```typescript | ||
| * const testScore = randomGaussian(0, 100) | ||
| * // => 52.8 (bell curve centered at 50, rarely hits extremes) | ||
| * ``` | ||
| */ | ||
@@ -136,2 +150,13 @@ function randomGaussian(min, max) { | ||
| * @returns A random number from the logarithmic distribution | ||
| * | ||
| * @example Generating values with exponential growth characteristics | ||
| * ```typescript | ||
| * // scale=1 produces values from 1 to e (~2.718) | ||
| * const smallScale = randomLogarithmic(1) | ||
| * // => 1.8 (values between 1 and ~2.7) | ||
| * | ||
| * // scale=5 produces values from 1 to e^5 (~148) | ||
| * const largeScale = randomLogarithmic(5) | ||
| * // => 42.3 (wider range, skewed toward lower values) | ||
| * ``` | ||
| */ | ||
@@ -150,2 +175,15 @@ function randomLogarithmic(scale) { | ||
| * @returns A random number from the power law distribution bounded by min and max | ||
| * | ||
| * @example Simulating social network follower counts (few have many, many have few) | ||
| * ```typescript | ||
| * // alpha > 2 creates "long tail" - most values near min | ||
| * const followerCount = randomPowerLaw(2.5, 1, 1000000) | ||
| * // => 127 (typically low, occasionally very large) | ||
| * ``` | ||
| * | ||
| * @example Modeling file sizes in a system | ||
| * ```typescript | ||
| * const fileSizeKb = randomPowerLaw(2.0, 1, 10000) | ||
| * // => 45 (many small files, rare large files) | ||
| * ``` | ||
| */ | ||
@@ -163,2 +201,15 @@ function randomPowerLaw(alpha, min, max) { | ||
| * @returns A pseudo-random number between 0 and 1. | ||
| * | ||
| * @example Reproducible random values for testing | ||
| * ```typescript | ||
| * // Same seed always yields the same result | ||
| * randomPseudo(42) | ||
| * // => 0.6853... (deterministic) | ||
| * | ||
| * randomPseudo(42) | ||
| * // => 0.6853... (identical) | ||
| * | ||
| * randomPseudo(43) | ||
| * // => 0.1762... (different seed, different result) | ||
| * ``` | ||
| */ | ||
@@ -175,2 +226,12 @@ function randomPseudo(seed) { | ||
| * @returns The pseudo-random variation as a number. | ||
| * | ||
| * @example Reproducible randomness for a specific timestamp | ||
| * ```typescript | ||
| * const releaseDate = new Date('2024-03-15T10:30:00Z') | ||
| * | ||
| * // Same date always produces the same result | ||
| * const value1 = randomPseudoTimeBased(releaseDate) | ||
| * const value2 = randomPseudoTimeBased(releaseDate) | ||
| * // value1 === value2 (deterministic) | ||
| * ``` | ||
| */ | ||
@@ -187,2 +248,15 @@ function randomPseudoTimeBased(seedTime) { | ||
| * @returns A random number between min (inclusive) and max (exclusive) | ||
| * | ||
| * @example Generating a random price within a budget range | ||
| * ```typescript | ||
| * const priceUsd = randomUniform(10, 50) | ||
| * // => 27.34 (any value equally likely within range) | ||
| * ``` | ||
| * | ||
| * @example Random coordinates for game object placement | ||
| * ```typescript | ||
| * const xPosition = randomUniform(0, 800) | ||
| * const yPosition = randomUniform(0, 600) | ||
| * // => x: 342.7, y: 198.2 | ||
| * ``` | ||
| */ | ||
@@ -197,10 +271,16 @@ function randomUniform(min, max) { | ||
| * @returns a version 4 UUID. | ||
| * | ||
| * @example Creating unique identifiers for entities | ||
| * ```typescript | ||
| * const userId = uuidV4() | ||
| * // => 'a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d' | ||
| * | ||
| * const sessionId = uuidV4() | ||
| * // => '9f8e7d6c-5b4a-4321-8765-4321fedcba98' | ||
| * ``` | ||
| */ | ||
| function uuidV4() { | ||
| return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (char) => { | ||
| // Generate a random hexadecimal digit, 0 - 15 | ||
| const randomHex = (random() * 16) | 0; | ||
| // Use the randomHex for 'x' and a specific subset for 'y' | ||
| const finalHex = char === 'x' ? randomHex : (randomHex & 0x3) | 0x8; | ||
| // Convert the final hexadecimal digit to a string | ||
| return finalHex.toString(16); | ||
@@ -214,2 +294,15 @@ }); | ||
| * @returns true if the string is a version 4 UUID, otherwise false. | ||
| * | ||
| * @example Validating user input as UUID | ||
| * ```typescript | ||
| * isUuidV4('a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d') | ||
| * // => true | ||
| * | ||
| * isUuidV4('not-a-uuid') | ||
| * // => false | ||
| * | ||
| * // Version 1 UUID (has '1' in third segment, not '4') | ||
| * isUuidV4('550e8400-e29b-11d4-a716-446655440000') | ||
| * // => false | ||
| * ``` | ||
| */ | ||
@@ -234,2 +327,1 @@ function isUuidV4(str) { | ||
| })({}); | ||
| //# sourceMappingURL=index.iife.js.map |
| var HyperfrontendRandomGenerator=function(n){"use strict";const o=globalThis.Math,r=o.floor,t=o.pow,e=o.sqrt,x=o.exp,a=o.log,u=o.sin,i=o.random;const s=globalThis.Error,c=globalThis.Reflect;function f(n){const o=1e4*u(n);return o-r(o)}return n.isUuidV4=function(n){return/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/.test(n)},n.randomExponential=function(n){const o=i();return-a(1-o)/n},n.randomGaussian=function n(o,r){if(o>r)throw t="Min value should be less than or equal to max value.",c.construct(s,[t,x]);var t,x;let u,f,l;do{u=2*i()-1,f=2*i()-1,l=u*u+f*f}while(l>=1||0===l);const d=(o+r)/2+u*e(-2*a(l)/l)*((r-o)/6);return d>=o&&d<=r?d:n(o,r)},n.randomLogarithmic=function(n){const o=i();return x(n*o)},n.randomPowerLaw=function(n,o,r){const e=i(),x=(t(r,n-1)-t(o,n-1))*e+t(o,n-1);return t(x,1/(n-1))},n.randomPseudo=f,n.randomPseudoTimeBased=function(n){return f(n.getTime())},n.randomUniform=function(n,o){return i()*(o-n)+n},n.uuidV4=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{const o=16*i()|0;return("x"===n?o:3&o|8).toString(16)})},n}({}); | ||
| //# sourceMappingURL=index.iife.min.js.map |
+110
-18
@@ -15,3 +15,2 @@ (function (global, factory) { | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Math = globalThis.Math; | ||
@@ -22,5 +21,2 @@ /** | ||
| const floor = _Math.floor; | ||
| // ============================================================================ | ||
| // Powers and Roots | ||
| // ============================================================================ | ||
| /** | ||
@@ -38,5 +34,2 @@ * (Safe copy) Returns the base to the exponent power. | ||
| const exp = _Math.exp; | ||
| // ============================================================================ | ||
| // Logarithms | ||
| // ============================================================================ | ||
| /** | ||
@@ -46,5 +39,2 @@ * (Safe copy) Returns the natural logarithm of a number. | ||
| const log = _Math.log; | ||
| // ============================================================================ | ||
| // Trigonometry | ||
| // ============================================================================ | ||
| /** | ||
@@ -54,5 +44,2 @@ * (Safe copy) Returns the sine of a number. | ||
| const sin = _Math.sin; | ||
| // ============================================================================ | ||
| // Random | ||
| // ============================================================================ | ||
| /** | ||
@@ -70,2 +57,11 @@ * (Safe copy) Returns a pseudo-random number between 0 and 1. | ||
| * @returns A random number from the exponential distribution | ||
| * | ||
| * @example Modeling time between events (e.g., customer arrivals) | ||
| * ```typescript | ||
| * // Higher lambda = shorter average wait time | ||
| * const averageWaitMinutes = 5 | ||
| * const lambda = 1 / averageWaitMinutes | ||
| * const waitTime = randomExponential(lambda) | ||
| * // => 3.7 (varies each call, most values clustered near 0-10) | ||
| * ``` | ||
| */ | ||
@@ -88,3 +84,2 @@ function randomExponential(lambda) { | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Error = globalThis.Error; | ||
@@ -99,2 +94,9 @@ const _Reflect = globalThis.Reflect; | ||
| * @returns A new Error instance. | ||
| * | ||
| * @example Creating Error instances | ||
| * ```typescript | ||
| * const error = createError('Operation failed') | ||
| * // With cause for error chaining | ||
| * const wrapped = createError('Request failed', { cause: originalError }) | ||
| * ``` | ||
| */ | ||
@@ -109,2 +111,14 @@ const createError = (message, options) => _Reflect.construct(_Error, [message, options]); | ||
| * @returns A random number from the Gaussian distribution bounded by min and max | ||
| * | ||
| * @example Simulating human heights in centimeters | ||
| * ```typescript | ||
| * const heightCm = randomGaussian(150, 200) | ||
| * // => 174.3 (most values cluster around the midpoint 175) | ||
| * ``` | ||
| * | ||
| * @example Generating test scores with realistic distribution | ||
| * ```typescript | ||
| * const testScore = randomGaussian(0, 100) | ||
| * // => 52.8 (bell curve centered at 50, rarely hits extremes) | ||
| * ``` | ||
| */ | ||
@@ -139,2 +153,13 @@ function randomGaussian(min, max) { | ||
| * @returns A random number from the logarithmic distribution | ||
| * | ||
| * @example Generating values with exponential growth characteristics | ||
| * ```typescript | ||
| * // scale=1 produces values from 1 to e (~2.718) | ||
| * const smallScale = randomLogarithmic(1) | ||
| * // => 1.8 (values between 1 and ~2.7) | ||
| * | ||
| * // scale=5 produces values from 1 to e^5 (~148) | ||
| * const largeScale = randomLogarithmic(5) | ||
| * // => 42.3 (wider range, skewed toward lower values) | ||
| * ``` | ||
| */ | ||
@@ -153,2 +178,15 @@ function randomLogarithmic(scale) { | ||
| * @returns A random number from the power law distribution bounded by min and max | ||
| * | ||
| * @example Simulating social network follower counts (few have many, many have few) | ||
| * ```typescript | ||
| * // alpha > 2 creates "long tail" - most values near min | ||
| * const followerCount = randomPowerLaw(2.5, 1, 1000000) | ||
| * // => 127 (typically low, occasionally very large) | ||
| * ``` | ||
| * | ||
| * @example Modeling file sizes in a system | ||
| * ```typescript | ||
| * const fileSizeKb = randomPowerLaw(2.0, 1, 10000) | ||
| * // => 45 (many small files, rare large files) | ||
| * ``` | ||
| */ | ||
@@ -166,2 +204,15 @@ function randomPowerLaw(alpha, min, max) { | ||
| * @returns A pseudo-random number between 0 and 1. | ||
| * | ||
| * @example Reproducible random values for testing | ||
| * ```typescript | ||
| * // Same seed always yields the same result | ||
| * randomPseudo(42) | ||
| * // => 0.6853... (deterministic) | ||
| * | ||
| * randomPseudo(42) | ||
| * // => 0.6853... (identical) | ||
| * | ||
| * randomPseudo(43) | ||
| * // => 0.1762... (different seed, different result) | ||
| * ``` | ||
| */ | ||
@@ -178,2 +229,12 @@ function randomPseudo(seed) { | ||
| * @returns The pseudo-random variation as a number. | ||
| * | ||
| * @example Reproducible randomness for a specific timestamp | ||
| * ```typescript | ||
| * const releaseDate = new Date('2024-03-15T10:30:00Z') | ||
| * | ||
| * // Same date always produces the same result | ||
| * const value1 = randomPseudoTimeBased(releaseDate) | ||
| * const value2 = randomPseudoTimeBased(releaseDate) | ||
| * // value1 === value2 (deterministic) | ||
| * ``` | ||
| */ | ||
@@ -190,2 +251,15 @@ function randomPseudoTimeBased(seedTime) { | ||
| * @returns A random number between min (inclusive) and max (exclusive) | ||
| * | ||
| * @example Generating a random price within a budget range | ||
| * ```typescript | ||
| * const priceUsd = randomUniform(10, 50) | ||
| * // => 27.34 (any value equally likely within range) | ||
| * ``` | ||
| * | ||
| * @example Random coordinates for game object placement | ||
| * ```typescript | ||
| * const xPosition = randomUniform(0, 800) | ||
| * const yPosition = randomUniform(0, 600) | ||
| * // => x: 342.7, y: 198.2 | ||
| * ``` | ||
| */ | ||
@@ -200,10 +274,16 @@ function randomUniform(min, max) { | ||
| * @returns a version 4 UUID. | ||
| * | ||
| * @example Creating unique identifiers for entities | ||
| * ```typescript | ||
| * const userId = uuidV4() | ||
| * // => 'a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d' | ||
| * | ||
| * const sessionId = uuidV4() | ||
| * // => '9f8e7d6c-5b4a-4321-8765-4321fedcba98' | ||
| * ``` | ||
| */ | ||
| function uuidV4() { | ||
| return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (char) => { | ||
| // Generate a random hexadecimal digit, 0 - 15 | ||
| const randomHex = (random() * 16) | 0; | ||
| // Use the randomHex for 'x' and a specific subset for 'y' | ||
| const finalHex = char === 'x' ? randomHex : (randomHex & 0x3) | 0x8; | ||
| // Convert the final hexadecimal digit to a string | ||
| return finalHex.toString(16); | ||
@@ -217,2 +297,15 @@ }); | ||
| * @returns true if the string is a version 4 UUID, otherwise false. | ||
| * | ||
| * @example Validating user input as UUID | ||
| * ```typescript | ||
| * isUuidV4('a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d') | ||
| * // => true | ||
| * | ||
| * isUuidV4('not-a-uuid') | ||
| * // => false | ||
| * | ||
| * // Version 1 UUID (has '1' in third segment, not '4') | ||
| * isUuidV4('550e8400-e29b-11d4-a716-446655440000') | ||
| * // => false | ||
| * ``` | ||
| */ | ||
@@ -235,2 +328,1 @@ function isUuidV4(str) { | ||
| })); | ||
| //# sourceMappingURL=index.umd.js.map |
| !function(n,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o((n="undefined"!=typeof globalThis?globalThis:n||self).HyperfrontendRandomGenerator={})}(this,function(n){"use strict";const o=globalThis.Math,t=o.floor,e=o.pow,r=o.sqrt,i=o.exp,x=o.log,u=o.sin,a=o.random;const s=globalThis.Error,f=globalThis.Reflect;function c(n){const o=1e4*u(n);return o-t(o)}n.isUuidV4=function(n){return/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/.test(n)},n.randomExponential=function(n){const o=a();return-x(1-o)/n},n.randomGaussian=function n(o,t){if(o>t)throw e="Min value should be less than or equal to max value.",f.construct(s,[e,i]);var e,i;let u,c,d;do{u=2*a()-1,c=2*a()-1,d=u*u+c*c}while(d>=1||0===d);const l=(o+t)/2+u*r(-2*x(d)/d)*((t-o)/6);return l>=o&&l<=t?l:n(o,t)},n.randomLogarithmic=function(n){const o=a();return i(n*o)},n.randomPowerLaw=function(n,o,t){const r=a(),i=(e(t,n-1)-e(o,n-1))*r+e(o,n-1);return e(i,1/(n-1))},n.randomPseudo=c,n.randomPseudoTimeBased=function(n){return c(n.getTime())},n.randomUniform=function(n,o){return a()*(o-n)+n},n.uuidV4=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{const o=16*a()|0;return("x"===n?o:3&o|8).toString(16)})}}); | ||
| //# sourceMappingURL=index.umd.min.js.map |
+14
-8
| # Changelog | ||
| This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). | ||
| All notable changes to this project will be documented in this file. | ||
| ## [0.0.4](https://github.com/AndrewRedican/hyperfrontend/compare/lib-random-generator-utils@0.0.3...lib-random-generator-utils@0.0.4) (2026-03-08) | ||
| ## [0.0.5](https://github.com/AndrewRedican/hyperfrontend/compare/c8db08be8b183addd26caf81fdd17fb3693f296f...466c0388c4cd516b9c704214140b4df1004098e6) - 2026-06-23 | ||
| ### Other | ||
| - **@hyperfrontend/workspace:** remove lib-builder and tool-package as implicit dependencies for all lib projects | ||
| ## [0.0.4](https://github.com/AndrewRedican/hyperfrontend/compare/lib-random-generator-utils@0.0.3...lib-random-generator-utils@0.0.4) - 2026-03-08 | ||
| ### Bug Fixes | ||
| * **lib-random-generator-utils:** correct package exports ([0feacc4](https://github.com/AndrewRedican/hyperfrontend/commit/0feacc4295e2f687e6c9f4df118db59aa10d1c69)) | ||
| - **lib-random-generator-utils:** correct package exports ([0feacc4](https://github.com/AndrewRedican/hyperfrontend/commit/0feacc4295e2f687e6c9f4df118db59aa10d1c69)) | ||
| ## [0.0.3](https://github.com/AndrewRedican/hyperfrontend/compare/lib-random-generator-utils@0.0.2...lib-random-generator-utils@0.0.3) (2026-03-02) | ||
| ## [0.0.3](https://github.com/AndrewRedican/hyperfrontend/compare/lib-random-generator-utils@0.0.2...lib-random-generator-utils@0.0.3) - 2026-03-02 | ||
| ### Bug Fixes | ||
| * **lib-random-generator-utils:** correct package exports ([0feacc4](https://github.com/AndrewRedican/hyperfrontend/commit/0feacc4295e2f687e6c9f4df118db59aa10d1c69)) | ||
| - **lib-random-generator-utils:** correct package exports ([0feacc4](https://github.com/AndrewRedican/hyperfrontend/commit/0feacc4295e2f687e6c9f4df118db59aa10d1c69)) | ||
| ## [0.0.2](https://github.com/AndrewRedican/hyperfrontend/compare/lib-random-generator-utils@0.0.1...lib-random-generator-utils@0.0.2) (2026-02-26) | ||
| ## [0.0.2](https://github.com/AndrewRedican/hyperfrontend/compare/lib-random-generator-utils@0.0.1...lib-random-generator-utils@0.0.2) - 2026-02-26 | ||
| ## 0.0.1 (2026-02-15) | ||
| ## 0.0.1 - 2026-02-15 | ||
+120
-95
| 'use strict'; | ||
| /** | ||
| * Safe copies of Math built-in methods. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/math | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Math = globalThis.Math; | ||
| /** | ||
| * (Safe copy) Returns the largest integer less than or equal to a number. | ||
| */ | ||
| const floor = _Math.floor; | ||
| // ============================================================================ | ||
| // Powers and Roots | ||
| // ============================================================================ | ||
| /** | ||
| * (Safe copy) Returns the base to the exponent power. | ||
| */ | ||
| const pow = _Math.pow; | ||
| /** | ||
| * (Safe copy) Returns the square root of a number. | ||
| */ | ||
| const sqrt = _Math.sqrt; | ||
| /** | ||
| * (Safe copy) Returns e raised to the power of a number. | ||
| */ | ||
| const exp = _Math.exp; | ||
| // ============================================================================ | ||
| // Logarithms | ||
| // ============================================================================ | ||
| /** | ||
| * (Safe copy) Returns the natural logarithm of a number. | ||
| */ | ||
| const log = _Math.log; | ||
| // ============================================================================ | ||
| // Trigonometry | ||
| // ============================================================================ | ||
| /** | ||
| * (Safe copy) Returns the sine of a number. | ||
| */ | ||
| const sin = _Math.sin; | ||
| // ============================================================================ | ||
| // Random | ||
| // ============================================================================ | ||
| /** | ||
| * (Safe copy) Returns a pseudo-random number between 0 and 1. | ||
| * Note: This is NOT cryptographically secure. For secure random values, | ||
| * use crypto.getRandomValues(). | ||
| */ | ||
| const random = _Math.random; | ||
| const index_cjs_js = require('./_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.cjs.js'); | ||
| const index_cjs_js$1 = require('./_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.cjs.js'); | ||
@@ -61,33 +11,18 @@ /** | ||
| * @returns A random number from the exponential distribution | ||
| * | ||
| * @example Modeling time between events (e.g., customer arrivals) | ||
| * ```typescript | ||
| * // Higher lambda = shorter average wait time | ||
| * const averageWaitMinutes = 5 | ||
| * const lambda = 1 / averageWaitMinutes | ||
| * const waitTime = randomExponential(lambda) | ||
| * // => 3.7 (varies each call, most values clustered near 0-10) | ||
| * ``` | ||
| */ | ||
| function randomExponential(lambda) { | ||
| const u = random(); | ||
| return -log(1 - u) / lambda; | ||
| const u = index_cjs_js.random(); | ||
| return -index_cjs_js.log(1 - u) / lambda; | ||
| } | ||
| /** | ||
| * Safe copies of Error built-ins via factory functions. | ||
| * | ||
| * Since constructors cannot be safely captured via Object.assign, this module | ||
| * provides factory functions that use Reflect.construct internally. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/error | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Error = globalThis.Error; | ||
| const _Reflect = globalThis.Reflect; | ||
| /** | ||
| * (Safe copy) Creates a new Error using the captured Error constructor. | ||
| * Use this instead of `new Error()`. | ||
| * | ||
| * @param message - Optional error message. | ||
| * @param options - Optional error options. | ||
| * @returns A new Error instance. | ||
| */ | ||
| const createError = (message, options) => _Reflect.construct(_Error, [message, options]); | ||
| /** | ||
| * Generates a random number following a Gaussian (normal) distribution within a specified range. | ||
@@ -98,14 +33,26 @@ * | ||
| * @returns A random number from the Gaussian distribution bounded by min and max | ||
| * | ||
| * @example Simulating human heights in centimeters | ||
| * ```typescript | ||
| * const heightCm = randomGaussian(150, 200) | ||
| * // => 174.3 (most values cluster around the midpoint 175) | ||
| * ``` | ||
| * | ||
| * @example Generating test scores with realistic distribution | ||
| * ```typescript | ||
| * const testScore = randomGaussian(0, 100) | ||
| * // => 52.8 (bell curve centered at 50, rarely hits extremes) | ||
| * ``` | ||
| */ | ||
| function randomGaussian(min, max) { | ||
| if (min > max) { | ||
| throw createError('Min value should be less than or equal to max value.'); | ||
| throw index_cjs_js$1.createError('Min value should be less than or equal to max value.'); | ||
| } | ||
| let u, v, s; | ||
| do { | ||
| u = random() * 2 - 1; | ||
| v = random() * 2 - 1; | ||
| u = index_cjs_js.random() * 2 - 1; | ||
| v = index_cjs_js.random() * 2 - 1; | ||
| s = u * u + v * v; | ||
| } while (s >= 1 || s === 0); | ||
| const std_dev = sqrt((-2 * log(s)) / s); | ||
| const std_dev = index_cjs_js.sqrt((-2 * index_cjs_js.log(s)) / s); | ||
| const z0 = u * std_dev; | ||
@@ -128,6 +75,17 @@ const mu = (min + max) / 2; | ||
| * @returns A random number from the logarithmic distribution | ||
| * | ||
| * @example Generating values with exponential growth characteristics | ||
| * ```typescript | ||
| * // scale=1 produces values from 1 to e (~2.718) | ||
| * const smallScale = randomLogarithmic(1) | ||
| * // => 1.8 (values between 1 and ~2.7) | ||
| * | ||
| * // scale=5 produces values from 1 to e^5 (~148) | ||
| * const largeScale = randomLogarithmic(5) | ||
| * // => 42.3 (wider range, skewed toward lower values) | ||
| * ``` | ||
| */ | ||
| function randomLogarithmic(scale) { | ||
| const u = random(); | ||
| return exp(scale * u); | ||
| const u = index_cjs_js.random(); | ||
| return index_cjs_js.exp(scale * u); | ||
| } | ||
@@ -142,7 +100,20 @@ | ||
| * @returns A random number from the power law distribution bounded by min and max | ||
| * | ||
| * @example Simulating social network follower counts (few have many, many have few) | ||
| * ```typescript | ||
| * // alpha > 2 creates "long tail" - most values near min | ||
| * const followerCount = randomPowerLaw(2.5, 1, 1000000) | ||
| * // => 127 (typically low, occasionally very large) | ||
| * ``` | ||
| * | ||
| * @example Modeling file sizes in a system | ||
| * ```typescript | ||
| * const fileSizeKb = randomPowerLaw(2.0, 1, 10000) | ||
| * // => 45 (many small files, rare large files) | ||
| * ``` | ||
| */ | ||
| function randomPowerLaw(alpha, min, max) { | ||
| const u = random(); | ||
| const factor = (pow(max, alpha - 1) - pow(min, alpha - 1)) * u + pow(min, alpha - 1); | ||
| return pow(factor, 1 / (alpha - 1)); | ||
| const u = index_cjs_js.random(); | ||
| const factor = (index_cjs_js.pow(max, alpha - 1) - index_cjs_js.pow(min, alpha - 1)) * u + index_cjs_js.pow(min, alpha - 1); | ||
| return index_cjs_js.pow(factor, 1 / (alpha - 1)); | ||
| } | ||
@@ -155,6 +126,19 @@ | ||
| * @returns A pseudo-random number between 0 and 1. | ||
| * | ||
| * @example Reproducible random values for testing | ||
| * ```typescript | ||
| * // Same seed always yields the same result | ||
| * randomPseudo(42) | ||
| * // => 0.6853... (deterministic) | ||
| * | ||
| * randomPseudo(42) | ||
| * // => 0.6853... (identical) | ||
| * | ||
| * randomPseudo(43) | ||
| * // => 0.1762... (different seed, different result) | ||
| * ``` | ||
| */ | ||
| function randomPseudo(seed) { | ||
| const x = sin(seed) * 10000; | ||
| return x - floor(x); | ||
| const x = index_cjs_js.sin(seed) * 10000; | ||
| return x - index_cjs_js.floor(x); | ||
| } | ||
@@ -167,2 +151,12 @@ | ||
| * @returns The pseudo-random variation as a number. | ||
| * | ||
| * @example Reproducible randomness for a specific timestamp | ||
| * ```typescript | ||
| * const releaseDate = new Date('2024-03-15T10:30:00Z') | ||
| * | ||
| * // Same date always produces the same result | ||
| * const value1 = randomPseudoTimeBased(releaseDate) | ||
| * const value2 = randomPseudoTimeBased(releaseDate) | ||
| * // value1 === value2 (deterministic) | ||
| * ``` | ||
| */ | ||
@@ -179,5 +173,18 @@ function randomPseudoTimeBased(seedTime) { | ||
| * @returns A random number between min (inclusive) and max (exclusive) | ||
| * | ||
| * @example Generating a random price within a budget range | ||
| * ```typescript | ||
| * const priceUsd = randomUniform(10, 50) | ||
| * // => 27.34 (any value equally likely within range) | ||
| * ``` | ||
| * | ||
| * @example Random coordinates for game object placement | ||
| * ```typescript | ||
| * const xPosition = randomUniform(0, 800) | ||
| * const yPosition = randomUniform(0, 600) | ||
| * // => x: 342.7, y: 198.2 | ||
| * ``` | ||
| */ | ||
| function randomUniform(min, max) { | ||
| return random() * (max - min) + min; | ||
| return index_cjs_js.random() * (max - min) + min; | ||
| } | ||
@@ -189,10 +196,16 @@ | ||
| * @returns a version 4 UUID. | ||
| * | ||
| * @example Creating unique identifiers for entities | ||
| * ```typescript | ||
| * const userId = uuidV4() | ||
| * // => 'a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d' | ||
| * | ||
| * const sessionId = uuidV4() | ||
| * // => '9f8e7d6c-5b4a-4321-8765-4321fedcba98' | ||
| * ``` | ||
| */ | ||
| function uuidV4() { | ||
| return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (char) => { | ||
| // Generate a random hexadecimal digit, 0 - 15 | ||
| const randomHex = (random() * 16) | 0; | ||
| // Use the randomHex for 'x' and a specific subset for 'y' | ||
| const randomHex = (index_cjs_js.random() * 16) | 0; | ||
| const finalHex = char === 'x' ? randomHex : (randomHex & 0x3) | 0x8; | ||
| // Convert the final hexadecimal digit to a string | ||
| return finalHex.toString(16); | ||
@@ -206,2 +219,15 @@ }); | ||
| * @returns true if the string is a version 4 UUID, otherwise false. | ||
| * | ||
| * @example Validating user input as UUID | ||
| * ```typescript | ||
| * isUuidV4('a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d') | ||
| * // => true | ||
| * | ||
| * isUuidV4('not-a-uuid') | ||
| * // => false | ||
| * | ||
| * // Version 1 UUID (has '1' in third segment, not '4') | ||
| * isUuidV4('550e8400-e29b-11d4-a716-446655440000') | ||
| * // => false | ||
| * ``` | ||
| */ | ||
@@ -222,2 +248,1 @@ function isUuidV4(str) { | ||
| exports.uuidV4 = uuidV4; | ||
| //# sourceMappingURL=index.cjs.js.map |
+178
-9
@@ -1,9 +0,178 @@ | ||
| export * from './random-exponential'; | ||
| export * from './random-gaussian'; | ||
| export * from './random-logarithmic'; | ||
| export * from './random-power-law'; | ||
| export * from './random-pseudo'; | ||
| export * from './random-pseudo-time-based'; | ||
| export * from './random-uniform'; | ||
| export * from './uuid-v4'; | ||
| //# sourceMappingURL=index.d.ts.map | ||
| /** | ||
| * Generates a random number following an exponential distribution. | ||
| * | ||
| * @param lambda - The rate parameter (λ) controlling the distribution shape | ||
| * @returns A random number from the exponential distribution | ||
| * | ||
| * @example Modeling time between events (e.g., customer arrivals) | ||
| * ```typescript | ||
| * // Higher lambda = shorter average wait time | ||
| * const averageWaitMinutes = 5 | ||
| * const lambda = 1 / averageWaitMinutes | ||
| * const waitTime = randomExponential(lambda) | ||
| * // => 3.7 (varies each call, most values clustered near 0-10) | ||
| * ``` | ||
| */ | ||
| declare function randomExponential(lambda: number): number; | ||
| /** | ||
| * Generates a random number following a Gaussian (normal) distribution within a specified range. | ||
| * | ||
| * @param min - The minimum value of the range | ||
| * @param max - The maximum value of the range | ||
| * @returns A random number from the Gaussian distribution bounded by min and max | ||
| * | ||
| * @example Simulating human heights in centimeters | ||
| * ```typescript | ||
| * const heightCm = randomGaussian(150, 200) | ||
| * // => 174.3 (most values cluster around the midpoint 175) | ||
| * ``` | ||
| * | ||
| * @example Generating test scores with realistic distribution | ||
| * ```typescript | ||
| * const testScore = randomGaussian(0, 100) | ||
| * // => 52.8 (bell curve centered at 50, rarely hits extremes) | ||
| * ``` | ||
| */ | ||
| declare function randomGaussian(min: number, max: number): number; | ||
| /** | ||
| * Generates a random number following a logarithmic distribution. | ||
| * | ||
| * @param scale - The scale parameter controlling the distribution spread | ||
| * @returns A random number from the logarithmic distribution | ||
| * | ||
| * @example Generating values with exponential growth characteristics | ||
| * ```typescript | ||
| * // scale=1 produces values from 1 to e (~2.718) | ||
| * const smallScale = randomLogarithmic(1) | ||
| * // => 1.8 (values between 1 and ~2.7) | ||
| * | ||
| * // scale=5 produces values from 1 to e^5 (~148) | ||
| * const largeScale = randomLogarithmic(5) | ||
| * // => 42.3 (wider range, skewed toward lower values) | ||
| * ``` | ||
| */ | ||
| declare function randomLogarithmic(scale: number): number; | ||
| /** | ||
| * Generates a random number following a power law distribution within a specified range. | ||
| * | ||
| * @param alpha - The power law exponent controlling the distribution | ||
| * @param min - The minimum value of the range | ||
| * @param max - The maximum value of the range | ||
| * @returns A random number from the power law distribution bounded by min and max | ||
| * | ||
| * @example Simulating social network follower counts (few have many, many have few) | ||
| * ```typescript | ||
| * // alpha > 2 creates "long tail" - most values near min | ||
| * const followerCount = randomPowerLaw(2.5, 1, 1000000) | ||
| * // => 127 (typically low, occasionally very large) | ||
| * ``` | ||
| * | ||
| * @example Modeling file sizes in a system | ||
| * ```typescript | ||
| * const fileSizeKb = randomPowerLaw(2.0, 1, 10000) | ||
| * // => 45 (many small files, rare large files) | ||
| * ``` | ||
| */ | ||
| declare function randomPowerLaw(alpha: number, min: number, max: number): number; | ||
| /** | ||
| * A simple pseudo-random number generator. | ||
| * | ||
| * @param seed - The seed for the generator. | ||
| * @returns A pseudo-random number between 0 and 1. | ||
| * | ||
| * @example Reproducible random values for testing | ||
| * ```typescript | ||
| * // Same seed always yields the same result | ||
| * randomPseudo(42) | ||
| * // => 0.6853... (deterministic) | ||
| * | ||
| * randomPseudo(42) | ||
| * // => 0.6853... (identical) | ||
| * | ||
| * randomPseudo(43) | ||
| * // => 0.1762... (different seed, different result) | ||
| * ``` | ||
| */ | ||
| declare function randomPseudo(seed: number): number; | ||
| /** | ||
| * Generates a deterministic pseudo-random variation based solely on the seed time. | ||
| * | ||
| * @param seedTime - The seed time for the variation. | ||
| * @returns The pseudo-random variation as a number. | ||
| * | ||
| * @example Reproducible randomness for a specific timestamp | ||
| * ```typescript | ||
| * const releaseDate = new Date('2024-03-15T10:30:00Z') | ||
| * | ||
| * // Same date always produces the same result | ||
| * const value1 = randomPseudoTimeBased(releaseDate) | ||
| * const value2 = randomPseudoTimeBased(releaseDate) | ||
| * // value1 === value2 (deterministic) | ||
| * ``` | ||
| */ | ||
| declare function randomPseudoTimeBased(seedTime: Date): number; | ||
| /** | ||
| * Generates a random number uniformly distributed within a specified range. | ||
| * | ||
| * @param min - The minimum value of the range (inclusive) | ||
| * @param max - The maximum value of the range (exclusive) | ||
| * @returns A random number between min (inclusive) and max (exclusive) | ||
| * | ||
| * @example Generating a random price within a budget range | ||
| * ```typescript | ||
| * const priceUsd = randomUniform(10, 50) | ||
| * // => 27.34 (any value equally likely within range) | ||
| * ``` | ||
| * | ||
| * @example Random coordinates for game object placement | ||
| * ```typescript | ||
| * const xPosition = randomUniform(0, 800) | ||
| * const yPosition = randomUniform(0, 600) | ||
| * // => x: 342.7, y: 198.2 | ||
| * ``` | ||
| */ | ||
| declare function randomUniform(min: number, max: number): number; | ||
| /** | ||
| * Generates a version 4 UUID. | ||
| * | ||
| * @returns a version 4 UUID. | ||
| * | ||
| * @example Creating unique identifiers for entities | ||
| * ```typescript | ||
| * const userId = uuidV4() | ||
| * // => 'a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d' | ||
| * | ||
| * const sessionId = uuidV4() | ||
| * // => '9f8e7d6c-5b4a-4321-8765-4321fedcba98' | ||
| * ``` | ||
| */ | ||
| declare function uuidV4(): string; | ||
| /** | ||
| * Validate if a string is a version 4 UUID. | ||
| * | ||
| * @param str the string to be validated. | ||
| * @returns true if the string is a version 4 UUID, otherwise false. | ||
| * | ||
| * @example Validating user input as UUID | ||
| * ```typescript | ||
| * isUuidV4('a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d') | ||
| * // => true | ||
| * | ||
| * isUuidV4('not-a-uuid') | ||
| * // => false | ||
| * | ||
| * // Version 1 UUID (has '1' in third segment, not '4') | ||
| * isUuidV4('550e8400-e29b-11d4-a716-446655440000') | ||
| * // => false | ||
| * ``` | ||
| */ | ||
| declare function isUuidV4(str: string): boolean; | ||
| export { isUuidV4, randomExponential, randomGaussian, randomLogarithmic, randomPowerLaw, randomPseudo, randomPseudoTimeBased, randomUniform, uuidV4 }; |
+1
-1
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/random-generator/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,kBAAkB,CAAA;AAChC,cAAc,WAAW,CAAA"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/random-generator/src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA"} |
+105
-80
@@ -1,53 +0,3 @@ | ||
| /** | ||
| * Safe copies of Math built-in methods. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/math | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Math = globalThis.Math; | ||
| /** | ||
| * (Safe copy) Returns the largest integer less than or equal to a number. | ||
| */ | ||
| const floor = _Math.floor; | ||
| // ============================================================================ | ||
| // Powers and Roots | ||
| // ============================================================================ | ||
| /** | ||
| * (Safe copy) Returns the base to the exponent power. | ||
| */ | ||
| const pow = _Math.pow; | ||
| /** | ||
| * (Safe copy) Returns the square root of a number. | ||
| */ | ||
| const sqrt = _Math.sqrt; | ||
| /** | ||
| * (Safe copy) Returns e raised to the power of a number. | ||
| */ | ||
| const exp = _Math.exp; | ||
| // ============================================================================ | ||
| // Logarithms | ||
| // ============================================================================ | ||
| /** | ||
| * (Safe copy) Returns the natural logarithm of a number. | ||
| */ | ||
| const log = _Math.log; | ||
| // ============================================================================ | ||
| // Trigonometry | ||
| // ============================================================================ | ||
| /** | ||
| * (Safe copy) Returns the sine of a number. | ||
| */ | ||
| const sin = _Math.sin; | ||
| // ============================================================================ | ||
| // Random | ||
| // ============================================================================ | ||
| /** | ||
| * (Safe copy) Returns a pseudo-random number between 0 and 1. | ||
| * Note: This is NOT cryptographically secure. For secure random values, | ||
| * use crypto.getRandomValues(). | ||
| */ | ||
| const random = _Math.random; | ||
| import { random, log, sqrt, exp, pow, sin, floor } from './_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.esm.js'; | ||
| import { createError } from './_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.esm.js'; | ||
@@ -59,2 +9,11 @@ /** | ||
| * @returns A random number from the exponential distribution | ||
| * | ||
| * @example Modeling time between events (e.g., customer arrivals) | ||
| * ```typescript | ||
| * // Higher lambda = shorter average wait time | ||
| * const averageWaitMinutes = 5 | ||
| * const lambda = 1 / averageWaitMinutes | ||
| * const waitTime = randomExponential(lambda) | ||
| * // => 3.7 (varies each call, most values clustered near 0-10) | ||
| * ``` | ||
| */ | ||
@@ -67,26 +26,2 @@ function randomExponential(lambda) { | ||
| /** | ||
| * Safe copies of Error built-ins via factory functions. | ||
| * | ||
| * Since constructors cannot be safely captured via Object.assign, this module | ||
| * provides factory functions that use Reflect.construct internally. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/error | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Error = globalThis.Error; | ||
| const _Reflect = globalThis.Reflect; | ||
| /** | ||
| * (Safe copy) Creates a new Error using the captured Error constructor. | ||
| * Use this instead of `new Error()`. | ||
| * | ||
| * @param message - Optional error message. | ||
| * @param options - Optional error options. | ||
| * @returns A new Error instance. | ||
| */ | ||
| const createError = (message, options) => _Reflect.construct(_Error, [message, options]); | ||
| /** | ||
| * Generates a random number following a Gaussian (normal) distribution within a specified range. | ||
@@ -97,2 +32,14 @@ * | ||
| * @returns A random number from the Gaussian distribution bounded by min and max | ||
| * | ||
| * @example Simulating human heights in centimeters | ||
| * ```typescript | ||
| * const heightCm = randomGaussian(150, 200) | ||
| * // => 174.3 (most values cluster around the midpoint 175) | ||
| * ``` | ||
| * | ||
| * @example Generating test scores with realistic distribution | ||
| * ```typescript | ||
| * const testScore = randomGaussian(0, 100) | ||
| * // => 52.8 (bell curve centered at 50, rarely hits extremes) | ||
| * ``` | ||
| */ | ||
@@ -127,2 +74,13 @@ function randomGaussian(min, max) { | ||
| * @returns A random number from the logarithmic distribution | ||
| * | ||
| * @example Generating values with exponential growth characteristics | ||
| * ```typescript | ||
| * // scale=1 produces values from 1 to e (~2.718) | ||
| * const smallScale = randomLogarithmic(1) | ||
| * // => 1.8 (values between 1 and ~2.7) | ||
| * | ||
| * // scale=5 produces values from 1 to e^5 (~148) | ||
| * const largeScale = randomLogarithmic(5) | ||
| * // => 42.3 (wider range, skewed toward lower values) | ||
| * ``` | ||
| */ | ||
@@ -141,2 +99,15 @@ function randomLogarithmic(scale) { | ||
| * @returns A random number from the power law distribution bounded by min and max | ||
| * | ||
| * @example Simulating social network follower counts (few have many, many have few) | ||
| * ```typescript | ||
| * // alpha > 2 creates "long tail" - most values near min | ||
| * const followerCount = randomPowerLaw(2.5, 1, 1000000) | ||
| * // => 127 (typically low, occasionally very large) | ||
| * ``` | ||
| * | ||
| * @example Modeling file sizes in a system | ||
| * ```typescript | ||
| * const fileSizeKb = randomPowerLaw(2.0, 1, 10000) | ||
| * // => 45 (many small files, rare large files) | ||
| * ``` | ||
| */ | ||
@@ -154,2 +125,15 @@ function randomPowerLaw(alpha, min, max) { | ||
| * @returns A pseudo-random number between 0 and 1. | ||
| * | ||
| * @example Reproducible random values for testing | ||
| * ```typescript | ||
| * // Same seed always yields the same result | ||
| * randomPseudo(42) | ||
| * // => 0.6853... (deterministic) | ||
| * | ||
| * randomPseudo(42) | ||
| * // => 0.6853... (identical) | ||
| * | ||
| * randomPseudo(43) | ||
| * // => 0.1762... (different seed, different result) | ||
| * ``` | ||
| */ | ||
@@ -166,2 +150,12 @@ function randomPseudo(seed) { | ||
| * @returns The pseudo-random variation as a number. | ||
| * | ||
| * @example Reproducible randomness for a specific timestamp | ||
| * ```typescript | ||
| * const releaseDate = new Date('2024-03-15T10:30:00Z') | ||
| * | ||
| * // Same date always produces the same result | ||
| * const value1 = randomPseudoTimeBased(releaseDate) | ||
| * const value2 = randomPseudoTimeBased(releaseDate) | ||
| * // value1 === value2 (deterministic) | ||
| * ``` | ||
| */ | ||
@@ -178,2 +172,15 @@ function randomPseudoTimeBased(seedTime) { | ||
| * @returns A random number between min (inclusive) and max (exclusive) | ||
| * | ||
| * @example Generating a random price within a budget range | ||
| * ```typescript | ||
| * const priceUsd = randomUniform(10, 50) | ||
| * // => 27.34 (any value equally likely within range) | ||
| * ``` | ||
| * | ||
| * @example Random coordinates for game object placement | ||
| * ```typescript | ||
| * const xPosition = randomUniform(0, 800) | ||
| * const yPosition = randomUniform(0, 600) | ||
| * // => x: 342.7, y: 198.2 | ||
| * ``` | ||
| */ | ||
@@ -188,10 +195,16 @@ function randomUniform(min, max) { | ||
| * @returns a version 4 UUID. | ||
| * | ||
| * @example Creating unique identifiers for entities | ||
| * ```typescript | ||
| * const userId = uuidV4() | ||
| * // => 'a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d' | ||
| * | ||
| * const sessionId = uuidV4() | ||
| * // => '9f8e7d6c-5b4a-4321-8765-4321fedcba98' | ||
| * ``` | ||
| */ | ||
| function uuidV4() { | ||
| return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (char) => { | ||
| // Generate a random hexadecimal digit, 0 - 15 | ||
| const randomHex = (random() * 16) | 0; | ||
| // Use the randomHex for 'x' and a specific subset for 'y' | ||
| const finalHex = char === 'x' ? randomHex : (randomHex & 0x3) | 0x8; | ||
| // Convert the final hexadecimal digit to a string | ||
| return finalHex.toString(16); | ||
@@ -205,2 +218,15 @@ }); | ||
| * @returns true if the string is a version 4 UUID, otherwise false. | ||
| * | ||
| * @example Validating user input as UUID | ||
| * ```typescript | ||
| * isUuidV4('a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d') | ||
| * // => true | ||
| * | ||
| * isUuidV4('not-a-uuid') | ||
| * // => false | ||
| * | ||
| * // Version 1 UUID (has '1' in third segment, not '4') | ||
| * isUuidV4('550e8400-e29b-11d4-a716-446655440000') | ||
| * // => false | ||
| * ``` | ||
| */ | ||
@@ -213,2 +239,1 @@ function isUuidV4(str) { | ||
| export { isUuidV4, randomExponential, randomGaussian, randomLogarithmic, randomPowerLaw, randomPseudo, randomPseudoTimeBased, randomUniform, uuidV4 }; | ||
| //# sourceMappingURL=index.esm.js.map |
+13
-7
| { | ||
| "name": "@hyperfrontend/random-generator-utils", | ||
| "version": "0.0.4", | ||
| "version": "0.0.5", | ||
| "description": "Statistical random distributions and UUID generation for simulations, testing, and procedural content.", | ||
@@ -34,6 +34,2 @@ "license": "MIT", | ||
| "require": "./index.cjs.js" | ||
| }, | ||
| "./bundle": { | ||
| "import": "./bundle/index.iife.min.js", | ||
| "require": "./bundle/index.iife.min.js" | ||
| } | ||
@@ -61,3 +57,13 @@ }, | ||
| "unpkg": "./bundle/index.umd.min.js", | ||
| "jsdelivr": "./bundle/index.umd.min.js" | ||
| } | ||
| "jsdelivr": "./bundle/index.umd.min.js", | ||
| "files": [ | ||
| "**/index.*", | ||
| "**/index.d.ts", | ||
| "CHANGELOG.md", | ||
| "FUNDING.md", | ||
| "LICENSE.md", | ||
| "README.md", | ||
| "SECURITY.md", | ||
| "!**/*.js.map" | ||
| ] | ||
| } |
+3
-1
@@ -38,2 +38,4 @@ # @hyperfrontend/random-generator-utils | ||
| • 👉 See [**documentation**](https://www.hyperfrontend.dev/docs/libraries/utils/random-generator/) | ||
| ## What is @hyperfrontend/random-generator-utils? | ||
@@ -221,2 +223,2 @@ | ||
| MIT | ||
| [MIT](https://github.com/AndrewRedican/hyperfrontend/blob/main/LICENSE.md) |
| {"version":3,"file":"index.iife.js","sources":["../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/math/index.ts","../../../../../../../../../../libs/utils/random-generator/src/random-exponential.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/error/index.ts","../../../../../../../../../../libs/utils/random-generator/src/random-gaussian.ts","../../../../../../../../../../libs/utils/random-generator/src/random-logarithmic.ts","../../../../../../../../../../libs/utils/random-generator/src/random-power-law.ts","../../../../../../../../../../libs/utils/random-generator/src/random-pseudo.ts","../../../../../../../../../../libs/utils/random-generator/src/random-pseudo-time-based.ts","../../../../../../../../../../libs/utils/random-generator/src/random-uniform.ts","../../../../../../../../../../libs/utils/random-generator/src/uuid-v4.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;IAAA;;;;;;;IAOG;IAEH;IACA,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI;IAkE7B;;IAEG;IACI,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK;IA0BhC;IACA;IACA;IAEA;;IAEG;IACI,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG;IAE5B;;IAEG;IACI,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI;IAY9B;;IAEG;IACI,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG;IAO5B;IACA;IACA;IAEA;;IAEG;IACI,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG;IAiB5B;IACA;IACA;IAEA;;IAEG;IACI,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG;IAiF5B;IACA;IACA;IAEA;;;;IAIG;IACI,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM;;IClQlC;;;;;IAKG;IACG,SAAU,iBAAiB,CAAC,MAAc,EAAA;IAC9C,IAAA,MAAM,CAAC,GAAG,MAAM,EAAE;QAClB,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM;IAC7B;;ICXA;;;;;;;;;;IAUG;IAEH;IACA,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK;IAQ/B,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO;IAGnC;;;;;;;IAOG;IACI,MAAM,WAAW,GAAG,CAAC,OAAgB,EAAE,OAAsB,KAAmB,QAAQ,CAAC,SAAS,CAA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FAAwF;IACxG,IAAA,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;IAC1B;;;;;;;;;;;;;;;;;;"} |
| {"version":3,"file":"index.iife.min.js","sources":["../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/math/index.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/error/index.ts","../../../../../../../../../../libs/utils/random-generator/src/random-pseudo.ts","../../../../../../../../../../libs/utils/random-generator/src/uuid-v4.ts","../../../../../../../../../../libs/utils/random-generator/src/random-exponential.ts","../../../../../../../../../../libs/utils/random-generator/src/random-gaussian.ts","../../../../../../../../../../libs/utils/random-generator/src/random-logarithmic.ts","../../../../../../../../../../libs/utils/random-generator/src/random-power-law.ts","../../../../../../../../../../libs/utils/random-generator/src/random-pseudo-time-based.ts","../../../../../../../../../../libs/utils/random-generator/src/random-uniform.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null],"names":["_Math","globalThis","Math","floor","pow","sqrt","exp","log","sin","random","_Error","Error","_Reflect","Reflect","randomPseudo","seed","x","str","test","lambda","u","randomGaussian","min","max","message","construct","options","v","s","value","scale","alpha","factor","seedTime","getTime","replace","char","randomHex","toString"],"mappings":"0DAUA,MAAMA,EAAQC,WAAWC,KAqEZC,EAAQH,EAAMG,MAiCdC,EAAMJ,EAAMI,IAKZC,EAAOL,EAAMK,KAebC,EAAMN,EAAMM,IAcZC,EAAMP,EAAMO,IAwBZC,EAAMR,EAAMQ,IA0FZC,EAAST,EAAMS,OCvP5B,MAAMC,EAAST,WAAWU,MAQpBC,EAAWX,WAAWY,QCbtB,SAAUC,EAAaC,GAC3B,MAAMC,EAAgB,IAAZR,EAAIO,GACd,OAAOC,EAAIb,EAAMa,EACnB,mBCeM,SAAmBC,GAEvB,MADgB,yFACDC,KAAKD,EACtB,sBCrBM,SAA4BE,GAChC,MAAMC,EAAIX,IACV,OAAQF,EAAI,EAAIa,GAAKD,CACvB,mBCDM,SAAUE,EAAeC,EAAaC,GAC1C,GAAID,EAAMC,EACR,MJoBwBC,EIpBN,uDJoBiEZ,EAASa,UAAUf,EAAQ,CAACc,EAASE,IAAjG,IAACF,EAAkBE,EIjB5C,IAAIN,EAAGO,EAAGC,EACV,GACER,EAAe,EAAXX,IAAe,EACnBkB,EAAe,EAAXlB,IAAe,EACnBmB,EAAIR,EAAIA,EAAIO,EAAIA,QACTC,GAAK,GAAW,IAANA,GAEnB,MAMMC,GAHMP,EAAMC,GAAO,EAFdH,EADKf,GAAM,EAAKE,EAAIqB,GAAMA,KAItBL,EAAMD,GAAO,GAI5B,OAAIO,GAASP,GAAOO,GAASN,EACpBM,EAEAR,EAAeC,EAAKC,EAE/B,sBC3BM,SAA4BO,GAChC,MAAMV,EAAIX,IACV,OAAOH,EAAIwB,EAAQV,EACrB,4BCD+BW,EAAeT,EAAaC,GACzD,MAAMH,EAAIX,IACJuB,GAAU5B,EAAImB,EAAKQ,EAAQ,GAAK3B,EAAIkB,EAAKS,EAAQ,IAAMX,EAAIhB,EAAIkB,EAAKS,EAAQ,GAClF,OAAO3B,EAAI4B,EAAQ,GAAKD,EAAQ,GAClC,2CCNM,SAAgCE,GACpC,OAAOnB,EAAamB,EAASC,UAC/B,kBCDM,SAAwBZ,EAAaC,GACzC,OAAOd,KAAYc,EAAMD,GAAOA,CAClC,sBNHE,MAAO,uCAAuCa,QAAQ,QAAUC,IAE9D,MAAMC,EAAwB,GAAX5B,IAAiB,EAMpC,OAH0B,MAAT2B,EAAeC,EAAyB,EAAZA,EAAmB,GAGhDC,SAAS,KAE7B"} |
| {"version":3,"file":"index.umd.js","sources":["../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/math/index.ts","../../../../../../../../../../libs/utils/random-generator/src/random-exponential.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/error/index.ts","../../../../../../../../../../libs/utils/random-generator/src/random-gaussian.ts","../../../../../../../../../../libs/utils/random-generator/src/random-logarithmic.ts","../../../../../../../../../../libs/utils/random-generator/src/random-power-law.ts","../../../../../../../../../../libs/utils/random-generator/src/random-pseudo.ts","../../../../../../../../../../libs/utils/random-generator/src/random-pseudo-time-based.ts","../../../../../../../../../../libs/utils/random-generator/src/random-uniform.ts","../../../../../../../../../../libs/utils/random-generator/src/uuid-v4.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;IAAA;;;;;;;IAOG;IAEH;IACA,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI;IAkE7B;;IAEG;IACI,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK;IA0BhC;IACA;IACA;IAEA;;IAEG;IACI,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG;IAE5B;;IAEG;IACI,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI;IAY9B;;IAEG;IACI,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG;IAO5B;IACA;IACA;IAEA;;IAEG;IACI,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG;IAiB5B;IACA;IACA;IAEA;;IAEG;IACI,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG;IAiF5B;IACA;IACA;IAEA;;;;IAIG;IACI,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM;;IClQlC;;;;;IAKG;IACG,SAAU,iBAAiB,CAAC,MAAc,EAAA;IAC9C,IAAA,MAAM,CAAC,GAAG,MAAM,EAAE;QAClB,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM;IAC7B;;ICXA;;;;;;;;;;IAUG;IAEH;IACA,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK;IAQ/B,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO;IAGnC;;;;;;;IAOG;IACI,MAAM,WAAW,GAAG,CAAC,OAAgB,EAAE,OAAsB,KAAmB,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;;IC7BrI;;;;;;IAMG;IACG,SAAU,cAAc,CAAC,GAAW,EA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"index.umd.min.js","sources":["../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/math/index.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/error/index.ts","../../../../../../../../../../libs/utils/random-generator/src/random-pseudo.ts","../../../../../../../../../../libs/utils/random-generator/src/uuid-v4.ts","../../../../../../../../../../libs/utils/random-generator/src/random-exponential.ts","../../../../../../../../../../libs/utils/random-generator/src/random-gaussian.ts","../../../../../../../../../../libs/utils/random-generator/src/random-logarithmic.ts","../../../../../../../../../../libs/utils/random-generator/src/random-power-law.ts","../../../../../../../../../../libs/utils/random-generator/src/random-pseudo-time-based.ts","../../../../../../../../../../libs/utils/random-generator/src/random-uniform.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null],"names":["_Math","globalThis","Math","floor","pow","sqrt","exp","log","sin","random","_Error","Error","_Reflect","Reflect","randomPseudo","seed","x","str","test","lambda","u","randomGaussian","min","max","message","construct","options","v","s","value","scale","alpha","factor","seedTime","getTime","replace","char","randomHex","toString"],"mappings":"mQAUA,MAAMA,EAAQC,WAAWC,KAqEZC,EAAQH,EAAMG,MAiCdC,EAAMJ,EAAMI,IAKZC,EAAOL,EAAMK,KAebC,EAAMN,EAAMM,IAcZC,EAAMP,EAAMO,IAwBZC,EAAMR,EAAMQ,IA0FZC,EAAST,EAAMS,OCvP5B,MAAMC,EAAST,WAAWU,MAQpBC,EAAWX,WAAWY,QCbtB,SAAUC,EAAaC,GAC3B,MAAMC,EAAgB,IAAZR,EAAIO,GACd,OAAOC,EAAIb,EAAMa,EACnB,YCeM,SAAmBC,GAEvB,MADgB,yFACDC,KAAKD,EACtB,sBCrBM,SAA4BE,GAChC,MAAMC,EAAIX,IACV,OAAQF,EAAI,EAAIa,GAAKD,CACvB,mBCDM,SAAUE,EAAeC,EAAaC,GAC1C,GAAID,EAAMC,EACR,MJoBwBC,EIpBN,uDJoBiEZ,EAASa,UAAUf,EAAQ,CAACc,EAASE,IAAjG,IAACF,EAAkBE,EIjB5C,IAAIN,EAAGO,EAAGC,EACV,GACER,EAAe,EAAXX,IAAe,EACnBkB,EAAe,EAAXlB,IAAe,EACnBmB,EAAIR,EAAIA,EAAIO,EAAIA,QACTC,GAAK,GAAW,IAANA,GAEnB,MAMMC,GAHMP,EAAMC,GAAO,EAFdH,EADKf,GAAM,EAAKE,EAAIqB,GAAMA,KAItBL,EAAMD,GAAO,GAI5B,OAAIO,GAASP,GAAOO,GAASN,EACpBM,EAEAR,EAAeC,EAAKC,EAE/B,sBC3BM,SAA4BO,GAChC,MAAMV,EAAIX,IACV,OAAOH,EAAIwB,EAAQV,EACrB,4BCD+BW,EAAeT,EAAaC,GACzD,MAAMH,EAAIX,IACJuB,GAAU5B,EAAImB,EAAKQ,EAAQ,GAAK3B,EAAIkB,EAAKS,EAAQ,IAAMX,EAAIhB,EAAIkB,EAAKS,EAAQ,GAClF,OAAO3B,EAAI4B,EAAQ,GAAKD,EAAQ,GAClC,2CCNM,SAAgCE,GACpC,OAAOnB,EAAamB,EAASC,UAC/B,kBCDM,SAAwBZ,EAAaC,GACzC,OAAOd,KAAYc,EAAMD,GAAOA,CAClC,sBNHE,MAAO,uCAAuCa,QAAQ,QAAUC,IAE9D,MAAMC,EAAwB,GAAX5B,IAAiB,EAMpC,OAH0B,MAAT2B,EAAeC,EAAyB,EAAZA,EAAmB,GAGhDC,SAAS,KAE7B"} |
| {"version":3,"file":"index.cjs.js","sources":["../../../../../../../../libs/utils/immutable-api/src/built-in-copy/math/index.ts","../../../../../../../../libs/utils/random-generator/src/random-exponential.ts","../../../../../../../../libs/utils/immutable-api/src/built-in-copy/error/index.ts","../../../../../../../../libs/utils/random-generator/src/random-gaussian.ts","../../../../../../../../libs/utils/random-generator/src/random-logarithmic.ts","../../../../../../../../libs/utils/random-generator/src/random-power-law.ts","../../../../../../../../libs/utils/random-generator/src/random-pseudo.ts","../../../../../../../../libs/utils/random-generator/src/random-pseudo-time-based.ts","../../../../../../../../libs/utils/random-generator/src/random-uniform.ts","../../../../../../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AAK,GAAG,CAAC,CAAC;AACpF,IAAA,OAAO,GAAG,CAAC,MAAM,EAAE,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC;AACrC;;ACZA;;;;;AAKG;AACG,SAAU,YAAY,CAAC,IAAY,EAAA;IACvC,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK;AAC3B,IAAA,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;AACrB;;ACTA;;;;;AAKG;AACG,SAAU,qBAAqB,CAAC,QAAc,EAAA;AAClD,IAAA,OAAO,YAAY,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;AACzC;;ACRA;;;;;;AAMG;AACG,SAAU,aAAa,CAAC,GAAW,EAAE,GAAW,EAAA;IACpD,OAAO,MAAM,EAAE,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG;AACrC;;ACTA;;;;AAIG;SACa,MAAM,GAAA;IACpB,OAAO,sCAAsC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,KAAI;;QAEtE,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC;;AAGrC,QAAA,MAAM,QAAQ,GAAG,IAAI,KAAK,GAAG,GAAG,SAAS,GAAG,CAAC,SAAS,GAAG,GAAG,IAAI,GAAG;;AAGnE,QAAA,OAAO,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;AAC9B,IAAA,CAAC,CAAC;AACJ;AAEA;;;;;AAKG;AACG,SAAU,QAAQ,CAAC,GAAW,EAAA;IAClC,MAAM,OAAO,GAAG,wFAAwF;AACxG,IAAA,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;AAC1B;;;;;;;;;;;;"} |
| {"version":3,"file":"index.esm.js","sources":["../../../../../../../../libs/utils/immutable-api/src/built-in-copy/math/index.ts","../../../../../../../../libs/utils/random-generator/src/random-exponential.ts","../../../../../../../../libs/utils/immutable-api/src/built-in-copy/error/index.ts","../../../../../../../../libs/utils/random-generator/src/random-gaussian.ts","../../../../../../../../libs/utils/random-generator/src/random-logarithmic.ts","../../../../../../../../libs/utils/random-generator/src/random-power-law.ts","../../../../../../../../libs/utils/random-generator/src/random-pseudo.ts","../../../../../../../../libs/utils/random-generator/src/random-pseudo-time-based.ts","../../../../../../../../libs/utils/random-generator/src/random-uniform.ts","../../../../../../../../libs/utils/random-generator/src/uuid-v4.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":"AAAA;;;;;;;AAOG;AAEH;AACA,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI;AAkE7B;;AAEG;AACI,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK;AA0BhC;AACA;AACA;AAEA;;AAEG;AACI,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG;AAE5B;;AAEG;AACI,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI;AAY9B;;AAEG;AACI,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG;AAO5B;AACA;AACA;AAEA;;AAEG;AACI,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG;AAiB5B;AACA;AACA;AAEA;;AAEG;AACI,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG;AAiF5B;AACA;AACA;AAEA;;;;AAIG;AACI,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM;;AClQlC;;;;;AAKG;AACG,SAAU,iBAAiB,CAAC,MAAc,EAAA;AAC9C,IAAA,MAAM,CAAC,GAAG,MAAM,EAAE;IAClB,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM;AAC7B;;ACXA;;;;;;;;;;AAUG;AAEH;AACA,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK;AAQ/B,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO;AAGnC;;;;;;;AAOG;AACI,MAAM,WAAW,GAAG,CAAC,OAAgB,EAAE,OAAsB,KAAmB,QAAQ,CAAC,SAAS,CAAC,MAAM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AACxG,IAAA,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;AAC1B;;;;"} |
| /** | ||
| * Generates a random number following an exponential distribution. | ||
| * | ||
| * @param lambda - The rate parameter (λ) controlling the distribution shape | ||
| * @returns A random number from the exponential distribution | ||
| */ | ||
| export declare function randomExponential(lambda: number): number; | ||
| //# sourceMappingURL=random-exponential.d.ts.map |
| {"version":3,"file":"random-exponential.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/random-generator/src/random-exponential.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAGxD"} |
| /** | ||
| * Generates a random number following a Gaussian (normal) distribution within a specified range. | ||
| * | ||
| * @param min - The minimum value of the range | ||
| * @param max - The maximum value of the range | ||
| * @returns A random number from the Gaussian distribution bounded by min and max | ||
| */ | ||
| export declare function randomGaussian(min: number, max: number): number; | ||
| export default randomGaussian; | ||
| //# sourceMappingURL=random-gaussian.d.ts.map |
| {"version":3,"file":"random-gaussian.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/random-generator/src/random-gaussian.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAyB/D;AAED,eAAe,cAAc,CAAA"} |
| /** | ||
| * Generates a random number following a logarithmic distribution. | ||
| * | ||
| * @param scale - The scale parameter controlling the distribution spread | ||
| * @returns A random number from the logarithmic distribution | ||
| */ | ||
| export declare function randomLogarithmic(scale: number): number; | ||
| //# sourceMappingURL=random-logarithmic.d.ts.map |
| {"version":3,"file":"random-logarithmic.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/random-generator/src/random-logarithmic.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGvD"} |
| /** | ||
| * Generates a random number following a power law distribution within a specified range. | ||
| * | ||
| * @param alpha - The power law exponent controlling the distribution | ||
| * @param min - The minimum value of the range | ||
| * @param max - The maximum value of the range | ||
| * @returns A random number from the power law distribution bounded by min and max | ||
| */ | ||
| export declare function randomPowerLaw(alpha: number, min: number, max: number): number; | ||
| //# sourceMappingURL=random-power-law.d.ts.map |
| {"version":3,"file":"random-power-law.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/random-generator/src/random-power-law.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAI9E"} |
| /** | ||
| * Generates a deterministic pseudo-random variation based solely on the seed time. | ||
| * | ||
| * @param seedTime - The seed time for the variation. | ||
| * @returns The pseudo-random variation as a number. | ||
| */ | ||
| export declare function randomPseudoTimeBased(seedTime: Date): number; | ||
| //# sourceMappingURL=random-pseudo-time-based.d.ts.map |
| {"version":3,"file":"random-pseudo-time-based.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/random-generator/src/random-pseudo-time-based.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,IAAI,GAAG,MAAM,CAE5D"} |
| /** | ||
| * A simple pseudo-random number generator. | ||
| * | ||
| * @param seed - The seed for the generator. | ||
| * @returns A pseudo-random number between 0 and 1. | ||
| */ | ||
| export declare function randomPseudo(seed: number): number; | ||
| //# sourceMappingURL=random-pseudo.d.ts.map |
| {"version":3,"file":"random-pseudo.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/random-generator/src/random-pseudo.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGjD"} |
| /** | ||
| * Generates a random number uniformly distributed within a specified range. | ||
| * | ||
| * @param min - The minimum value of the range (inclusive) | ||
| * @param max - The maximum value of the range (exclusive) | ||
| * @returns A random number between min (inclusive) and max (exclusive) | ||
| */ | ||
| export declare function randomUniform(min: number, max: number): number; | ||
| //# sourceMappingURL=random-uniform.d.ts.map |
| {"version":3,"file":"random-uniform.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/random-generator/src/random-uniform.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9D"} |
-14
| /** | ||
| * Generates a version 4 UUID. | ||
| * | ||
| * @returns a version 4 UUID. | ||
| */ | ||
| export declare function uuidV4(): string; | ||
| /** | ||
| * Validate if a string is a version 4 UUID. | ||
| * | ||
| * @param str the string to be validated. | ||
| * @returns true if the string is a version 4 UUID, otherwise false. | ||
| */ | ||
| export declare function isUuidV4(str: string): boolean; | ||
| //# sourceMappingURL=uuid-v4.d.ts.map |
| {"version":3,"file":"uuid-v4.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/random-generator/src/uuid-v4.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,MAAM,IAAI,MAAM,CAW/B;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAG7C"} |
1258
40.56%223
0.9%66834
-15.31%18
-50%