@evojs/math
Version:
Nodejs math extension
20 lines (19 loc) • 413 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.random = void 0;
function random(min, max) {
if (min !== void 0) {
if (max === void 0) {
max = Math.floor(min);
min = 0;
}
else {
max = Math.floor(max);
min = Math.ceil(min);
}
var value = Math.random() * (max - min);
return Math.floor(value + min);
}
return Math.random();
}
exports.random = random;