您的位置:首页 > 其它

随机数random

2016-07-30 11:01 369 查看
  Math.random():是0~1之间的随机小数

  Math.round():是四舍五入取整

  Math.round(Math.random()) :0与1两整数

  Math.round(Math.random()*n):0~n之间随机整数

  Math.round(Math.random()*n+m):m~(n+m)之间的整数

  Math.ceil():向上取整

  Math.ceil(Math.random()*x):1~x之间的随机整数
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: