JS ⟩ value ⟩ primitive ⟩ number ⟩ Random
// 2023.03.01 - 10:11 (•) first draft
// -----------------------------------------------------------
const { random, floor } = Math;
// ⭐ Random
// -----------------------------------------------------------
// - Random.int()
// - Random.float()
class Random {
// ⭐️ Random.int(min, max)
// [min, max], (included)
static int(min, max) {
return random() * (max - min + 1) + min | 0;
}
// ⭐️ Random.float(min, max)
// [min, max) (exclusive)
static float(min, max) {
return random() * (max - min) + min;
}
}
// export
module.exports = {
Random,
}