@jsmlt/jsmlt
Version:
JavaScript Machine Learning
18 lines (16 loc) • 479 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.randint = randint;
/* eslint import/prefer-default-export: "off" */
/**
* Generate a random integer between a lower bound (inclusive) and an upper bound (exclusive).
*
* @param {number} a Lower bound (inclusive)
* @param {number} b Upper bound (exclusive)
* @return {number} Random integer in range [a,b]
*/
function randint(a, b) {
return a + Math.floor((b - a) * Math.random());
}