UNPKG

rc-js-util

Version:

A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.

22 lines 771 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mathBoundRandom = void 0; const _debug_js_1 = require("../../debug/_debug.js"); /** * @public * Create a random value between min and max. * * @remarks * NaN input will cause a debug error. Max greater than min will cause a debug error. * * See {@link mathBoundRandom}. */ function mathBoundRandom(min, max) { _BUILD.DEBUG && _debug_js_1._Debug.runBlock(() => { _debug_js_1._Debug.assert(min < max, "min must be smaller than max"); _debug_js_1._Debug.assert(!isNaN(min) && !isNaN(max), "nan input not supported"); }); return Math.random() * (max - min) + min; } exports.mathBoundRandom = mathBoundRandom; //# sourceMappingURL=math-bound-random.js.map