标签:数据 类型 ext ase 数据类型 方法 new font color
方法一:
举例:
(int)(1+Math.random()*(10-1+1)) 生成1~10的随机数。
(数据类型)最小值+Math.random()*最大值
举例:
(int)(1+Math.random()*10) 生成1~10的随机数。
通过java.util包中的Random类的nextInt方法来得到1-10的int随机数
Random ra = new Random(); ra.nextInt(10)+1
标签:数据 类型 ext ase 数据类型 方法 new font color
原文地址:http://www.cnblogs.com/StoneLuo/p/7397933.html