function selectRandom(first,last){
var length = last-first+1;
res = Math.floor(Math.random()*length + first);
return res;
}
var number = selectRandom(11,19);
console.log(number);
function selectRandom(first,last){
var length = last-first+1;
res = Math.floor(Math.random()*length + first);
return res;
}
var number = selectRandom(11,19);
console.log(number);
本文标题:Math.random()随机返回任意两数之间的自然数
本文链接:https://www.haomeiwen.com/subject/rznywxtx.html
网友评论