import java.util.Random;public class RandomDemo { public static void main(String[] args) { long t = System.currentTimeMillis();//获得当前时间的毫秒数 Random rd = new Random(t);//作为种子数传入到Random的构造器中 System.out.println(rd.nextInt());//生成随即整数 }}