import java.util.*;
public class RandomNum {
public static void main(String[] args){
List<Integer> list = new ArrayList<Integer>();//感觉用list比较方便,嘿嘿
for(int x = 0;x<10;){
int temp = (int)(Math.random()*20)+1;
if(!list.contains(temp)){
list.add(temp);
x++;
}
}
for(int x:list){
System.out.println(x);
}
}
}好 |