public void testSort3() { List<Student> studentList = new ArrayList<Student>();//學(xué)生集合 List<String> studentIdList = new ArrayList<String>();//學(xué)生ID集合 //生成隨機不重復(fù)的1000以內(nèi)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
提交
取消