public void testSort3() { List<Student> studentList = new ArrayList<Student>();//学生集合 List<String> studentIdList = new ArrayList<String>();//学生ID集合 //生成随机不重复的1000以内ID Random rand = new Random(); for (int i = 0; i < 3; i++) { //String str; do { String str = new String(rand.nextInt(1000) + ""); } while (studentIdList.contains(str)); studentIdList.add(str); } }
添加回答
举报
0/150
提交
取消