返回指定区间的随机整数(1~100)
// 0 ~ 100
function getRand(min, max){
return Math.floor(Math.random()*(max-min+1))+min;
}
console.log( getRand(1,100) );
console.log( getRand(1,100) );
console.log( getRand(1,100) );
console.log( getRand(1,100) );
console.log( getRand(1,100) );
console.log( getRand(1,100) );
固定写法。