文件名称:Roll
- 所属分类:
- JSP源码/Java
- 资源属性:
- [Java] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 1kb
- 下载次数:
- 0次
- 提 供 者:
- 杨*
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
做一个应用程序模拟掷色子的游戏:
1)使用Math.random方法分别取得两个随机数(掷两次色子),每个随机数为范围在1-6之间的整数,把两个随机数相加(则和的范围是2-12);
2)模拟36000次,然后计算和为2-12间各数出现的几率。判断是否合理(如:有6种方式可以掷出和为7,所以7的出现几率应该大概为1/6)。
-To do an application simulates the dice game:
1) Use the Math.random method to obtain two random numbers (throwing
Two dice), each random number as an integer in the range between 1-6,
Two random numbers together (and the range of 2-12)
2) simulation 36,000 times and then calculate and for 2-12 between each number appears
Chance. Determine whether reasonable
1)使用Math.random方法分别取得两个随机数(掷两次色子),每个随机数为范围在1-6之间的整数,把两个随机数相加(则和的范围是2-12);
2)模拟36000次,然后计算和为2-12间各数出现的几率。判断是否合理(如:有6种方式可以掷出和为7,所以7的出现几率应该大概为1/6)。
-To do an application simulates the dice game:
1) Use the Math.random method to obtain two random numbers (throwing
Two dice), each random number as an integer in the range between 1-6,
Two random numbers together (and the range of 2-12)
2) simulation 36,000 times and then calculate and for 2-12 between each number appears
Chance. Determine whether reasonable
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Roll.java