随机数random

  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之间的随机整数

posted @ 2016-07-30 11:01  Heroine.z  阅读(146)  评论(0编辑  收藏  举报