生成的10个数都是一样的
- public static void main(String[] args) {
- for (int i=0;i<10;i++){
- Random r = new Random(10);
- data = r.nextInt(10);
- System.out.print(rand);
- System.out.print(" ");
- }
- }
上面这段代码生成的10个数都不一样,但是再次执行的时候生成的10个数序列和上次执行for循环生成的序列是一样的,这点就是上面那句的意思
- public static void main(String[] args) {
- Random r = new Random(10);
- for (int i=0;i<10;i++){
- data = r.nextInt(10);
- System.out.print(rand);
- System.out.print(" ");
- }
- }
已抢17009个
抢已抢49956个
抢已抢184262个
抢已抢66103个
抢已抢350407个
抢已抢664241个
抢