tags:

views:

37

answers:

3

I have a method that does a lookup of some elements and returns them to the user:

List<DailyPrayer> dailyPrayers = (List<DailyPrayer>) query.execute();
return dailyPrayers;

These are daily prayers so I want the user to see a different prayer each time so they do not get bored with seeing the same content in the same order over and over.

How can I randomize the List?

+5  A: 

Collections.shuffle(list)

Randomly permutes the specified list using a default source of randomness. All permutations occur with approximately equal likelihood.

Bozho
+1  A: 

You can use Collections.shuffle(dailyPrayers);

akf
+1  A: 
shuffle(List<?> list)
          Randomly permutes the specified list using a default source of randomness.
infinity