rather strange pattern. why do you need shuffle? ids.get(random().nextInt(ids.size()))