随机数

Random rad = new Random();

String [] temp={"a","b","c","d","e"};
ArrayList list = new ArrayList();
for (int j = 0; j < temp.length; j++) {
list.add(temp[j]);
}
for (int j = 0; j < temp.length; j++) {
int index = rad.nextInt(list.size());
System.out.println(list.get(index));
list.remove(list.get(index));
}

原文地址:https://www.cnblogs.com/qq3245792286/p/6684470.html