Archive for the ‘Java’ Category

If you need to randomize or shuffle a List in Java (ArrayList, LinkedList, etc) you can do this with the Collections.shuffle(<list>) function. This is a static function which works on all List types. For example: import java.util.ArrayList; import java.util.Collections; … ArrayList<Integer> myList = new ArrayList<Integer>(); for (int x = 0; x < 10; ++x) { [...]