public static void main(String[] args) {
Random r = new Random(1000);
System.out.println(r.nextInt());
System.out.println(r.nextInt());
System.out.println(r.nextInt());
System.out.println(r.nextInt());
System.out.println(r.nextInt(100));
System.out.println(r.nextInt(100));
System.out.println(r.nextInt(100));
System.out.println(r.nextInt(100));
}
在指定种子1000的情况下,同一行代码,每次运行的结果是一样的。
但是,为什么每个System.out.println(r.nextInt())运行出来的结果都不一样。每个System.out.println(r.nextInt(100))也不一样?
请各位大神指教! |
|