//参数1为库的总题数据,count为生成的随机数的数量
public Set<String> getIds(List<ExamCenter> listExam, int count) {
Set<String> result = new HashSet<String>();
// 用来生成随机数
Random r = new Random();
while (result.size() < count) {
result.add(listExam.get(r.nextInt(listExam.size() - 1)).getId());
}
return result;
}