Math.random()随机返回任意两数之间的自然数
2017-12-17 本文已影响14人
一叶信笺飘云间
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);