随机数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之间的随机整数
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之间的随机整数
相关文章推荐
- Java容器三:HashMap
- Face Detection with the Faster R-CNN(数据集标注对比研究报告 )
- web框架学习前复习——xml(1)
- 337. House Robber III
- Spring02
- HDU-5768-Lucky7(中国剩余定理+容斥)
- Java (while结构)
- 线程
- Spring
- JDB1.8的项目放到1.7的eclipse运行遇到的问题
- IP地址详解
- Spring4笔记----动态代理
- 转载Android Volley完全解析
- 最小费用流bellman-ford算法总结
- 经典算法
- UVA340 UVALive5448 Master-Mind Hints【水题】
- 260. Single Number III [medium] (Python)
- JSP中的Script标签
- php中base64_encode base64_decode加密解密函数
- hdu 5775 Bubble Sort