JavaScript Math 对象常用方法

Math.abs(x):可返回数的绝对值
Math.ceil(x):向上取整
Math.floor(x):向下取整
Math.max(x,y):最大值
Math.min(x,y):最小值
Math.random(x):随机数
Math.round(x):四舍五入

获取指定范围内的随机数

var x=Math.floor(Math.random()*(max-min+1))+min;
原文地址:https://www.cnblogs.com/xjuan/p/5441960.html