Random类的常用方法
| 方法 | 备注 | 
| Int nextInt() | 返回一个int类型的随机数 | 
| Int nextInt(n) | 返回一个0到n之间的数,不包括n | 
| Double nextDouble() | 返回一个0-1之间的数 | 
| Float nextFloat() | 返回一个0-1之间的数 | 
| Long nextLong() | 返回一个长整形 | 
/*************Random的使用******************/
 public static void main(String[] args) {
  //种子固定生成的随机数也就固定了
  Random random = new Random(500);
  System.out.println(random.nextInt());
  //种子不固定
  Random rand = new Random();
  System.out.println(rand.nextInt());//产生int随机数
  System.out.println(rand.nextInt(20));//产生0~20(不包含20)的随机数
 }
原文:http://www.cnblogs.com/danmao/p/3815876.html