Random rand = new Random();int i = rand.nextInt(); //int范围类的随机数i = rand.nextInt(100); //生成0-100以内的随机数i = (int)(Math.random() * 100); //0-100以内的随机数,用Matn.random()方式