当前位置: 代码迷 >> Java Web开发 >> (Math.floor(Math.random()*3)==0))是什么?解决思路
  详细解决方案

(Math.floor(Math.random()*3)==0))是什么?解决思路

热度:1320   发布时间:2016-04-17 10:54:30.0
(Math.floor(Math.random()*3)==0))是什么?
这个是判断随机30%的概率吗?要50%的概率怎么改?

------解决方案--------------------
java api里面对Math.random()的说明
Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0. 
Math.floor()的说明
Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer.
  相关解决方案