随机数

// min-max之间的随机整数
var s=Math.round(Math.random()*(max-min))+min;
// 或者
Math.floor(Math.random()*max)+min;
Math.ceil(number)//向上取整,返回大于等于n的最小整数
Math.floor(number) //向下取整,返回小于等于n的最大整数
Math.round(number) //正真的四舍五入
原文地址:https://www.cnblogs.com/-walker/p/6648945.html