第六次作业修改版
package choujiang;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;
public class ChouJiang {
ArrayList
public void addPerson(){
if(list == null){
list = new ArrayList<Integer>();
for(int i = 1;i < 200;i++){
list.add(i);
}
}
Collections.shuffle(list);
}
public void CJ(){
Random r = new Random();
int a = r.nextInt(200);
System.out.println("一等" + list.get(a) + "号");
list.remove(a);
for(int j = 1;j<=10;j++){
a = r.nextInt(200);
System.out.println("二等" + list.get(a) + "号");
list.remove(a);
}
}
public static void main(String[] args){
ChouJiang c = new ChouJiang();
c.addPerson();
c.CJ();
}
}