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;
posted @ 2016-04-28 11:25  害羞熊5  阅读(253)  评论(0编辑  收藏  举报