@fivem-ts/shared
Version:
FiveM Typescript wrapper shared part
22 lines (21 loc) • 616 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRandomInt = getRandomInt;
/**
* Generates a random integer between the specified minimum and maximum values.
*
* @example
* ```ts
* getRandomInt(1, 10); // A random integer between 1 and 10
* ```
*
* @param {number} min - The minimum value (inclusive).
* @param {number} max - The maximum value (inclusive).
*
* @return {number} A random integer between min and max.
*/
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.ceil(max);
return Math.floor(Math.random() * (max - min)) + min;
}
;