常用的Math方法记录
2016-05-29 20:42
246 查看
//取 绝对值 Math.abs(-1); //取 两者最小值 Math.min(1, 2); //取 两者最大值 Math.max(1, 2); //random 取得一个 在[0.0, 1.0)之间 的随机数 Math.random(); //取 平方根的值 Math.sqrt(4); //幂运算 2的3次幂 Math.pow(2, 3); //四舍五入运算 Math.round(2.1);//2 Math.round(2.5);//3 //补充,产生 Min和Max之间的 数字 Math.round(Math.random()*(Max-Min)+Min)
相关文章推荐
- Linux下安装gcc 、g++ /gfortran编译器
- 学习进度13
- $.fn.extend和$.extend的理解
- Metal 着色语言编程指南 二三
- 20160529_线程范围内数据共享
- 理工OJ刷题分数晋级前三十——纪念一下(坚持才是你对)
- 让开发自动化: 选择持续集成服务器
- Git Github jekyll,gem Liquid模板语言 Markdown
- bzoj3262: 陌上花开
- Least Squares Method & Gradient Descent
- 五月英语总结
- 双调旅程(bitonic tour)问题(POJ2677、ZOJ2096)
- hibernate进阶之路(一)
- 最简短总结-整数快速幂
- 《JavaScript学习笔记四》:getElementsByTagName的使用以及全选、反选和取消功能实现
- 学习python——处理mysql
- python unittest 之mock学习笔记(续一)
- 使用maven mvn archetype:create 创建maven项目出错
- win8.1系统快速关机的两种方法
- serservlet 一生