public void randResultSet() {
HashSet
SessionFactory sf = HibernateSessionFactory.getSessionFactory();
Session s = sf.openSession();
List
int maxSize = list.size();
while (true) {
int randNumber = (int) (Math.random() * maxSize + 1) - 1;
set.add(randNumber);
if (set.size() >= 10) {
break;
}
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
for (int a : set) {
user u = (user) list.get(a);
System.out.println(u.getName());
}
}