JavaScript Получите случайное плавающее число
const randomFloat = (min, max) => Math.random() * (max - min) + min;
Batman
const randomFloat = (min, max) => Math.random() * (max - min) + min;
function getRandomNumberBetween(min,max){
return Math.floor(Math.random()*(max-min+1)+min);
}
function randomFloat(min, max)
{
return Math.random() * (max - min) + min;
}
function getRandomIntInclusive(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min; //The maximum is inclusive and the minimum is inclusive
}
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) + min; //The maximum is exclusive and the minimum is inclusive
}