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

random for a series of random numbers?

2011-11-27 
random for a series of random numbers??????UsingMath.randomworkswellwhenyouneedtogenerateasingleran

random for a series of random numbers??????
Using   Math.random   works   well   when   you   need   to   generate   a   single   random   number.   If   you   need   to   generate   a   series   of   random   numbers,   you   should   create   an   instance   of   java.util.Random   and   invoke   methods   on   that   object   to   generate   numbers.   

我想让大家帮忙给俺个这样的例子,用java.util.Random中的哪些方法就可以产生一系列的随机数呢???

[解决办法]
nextBytes(byte[] bytes)
[解决办法]
Random r = new Random ();
r.nextDouble(),r.nextFloat(),r.nextInt()...
[解决办法]
blog 更新:
think in java 各章后练习答案.....
http://blog.csdn.net/heimaoxiaozi/

热点排行
Bad Request.