diasa-fly

Math 是数学函数,里面提供了几个操作数字的方法

  1、Math.abs() 取绝对值

  2、Math.ceil() 向上取整

  3、Math.floor() 向下取整

  4、Math.round() 四舍五入  

  5、Math.max(val1,val2,val3) 取最大值

  6、Math.min(val1,val2,val3) 取最小值

  7、Math.random() 获取[0-1)之前的随机小数

    获取[n-m] 之间的随机整数

    Math.round(Math.random()*(m-n)+n)

  获取随机数方法:

 

    

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-11-28
  • 2021-04-23
  • 2022-03-03
  • 2021-12-04
  • 2022-12-23
  • 2021-06-14
  • 2021-12-23
猜你喜欢
  • 2021-05-17
  • 2022-01-26
  • 2022-12-23
  • 2021-11-18
  • 2021-09-07
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案