码迷,mamicode.com
首页 > 其他好文 > 详细

随机数

时间:2017-04-09 15:03:02      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:print   and   str   rem   for   arraylist   next   dom   随机   

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

随机数

标签:print   and   str   rem   for   arraylist   next   dom   随机   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!