Java Utililty Methods ArrayList Shuffle

List of utility methods to do ArrayList Shuffle

Description

The list of methods to do ArrayList Shuffle are organized into topic(s).

Method

ArrayListshuffle(ArrayList l)
shuffle
long seed = System.nanoTime();
Collections.shuffle(l, new Random(seed));
return l;
ArrayListshuffle(ArrayList population, int sample)
shuffle
ArrayList<T> newList = new ArrayList<T>();
ArrayList<T> ret = new ArrayList<T>();
newList.addAll(population);
Collections.shuffle(newList);
ret.addAll(newList);
for (int i = sample; i < ret.size(); i++) {
    ret.remove(i);
    i--;
...