console.log(randomEvenInt(1, 35)) // 7
console.log(randomEvenInt(1, 35)) // 1
console.log(randomEvenInt(1, 35)) // 17
console.log(randomEvenInt(1, 35)) // 15
function randomEvenInt(min,max){
let v = Math.round(min+Math.random() * (max-min));
return v%2 != 0?v:randomEvenInt(min,max);
}
var n_random = 2 * randomEvenInt((min + 1) / 2, (max + 1) / 2) - 1;
function randomEvenInt(min, max) {
return (min + Math.random() * (max - min)) | 1;
}
function randomEvenInt(min, max) {
const result = Math.floor(min + Math.random() * (max - min));
return result + ((result % 2) - 1);
}