1.获取指定范围内的随机数
function getRadomNum(min,max){ return Math.floor(Math.random() * (max - min + 1)) + min; }
2.随机获取数组中的元素
function getRadomFromArr(arr){ return arr[Math.floor(Math.random()*arr.length)]; }
1.获取指定范围内的随机数
function getRadomNum(min,max){ return Math.floor(Math.random() * (max - min + 1)) + min; }
2.随机获取数组中的元素
function getRadomFromArr(arr){ return arr[Math.floor(Math.random()*arr.length)]; }