随机数

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));
}

posted @ 2017-04-09 13:30  My_blog_s  阅读(131)  评论(0编辑  收藏  举报