未命名.jpg (5.44 KB, 下载次数: 33)
下载附件
2013-1-28 00:12 上传
赵文 发表于 2013-1-28 00:01 改成这样 int x =(int)(Math.random()*10+1);
luck28 发表于 2013-1-28 00:03 Math.random()这个方法是包含0,不包含10的随机数。。。 所以我们把它+1就可以得到解决了。 ...
terrynzh 发表于 2013-1-28 01:22 因Math类的random方法是返回带正号的 double 值,该值大于等于 0.0 且小于 1.0。有可能返回0.0,而0.0转换成 ...