首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

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

2012-03-11 
(Math.floor(Math.random()*3)0))是什么?这个是判断随机30%的概率吗?要50%的概率怎么改?[解决办法]java

(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.

热点排行