@@ -0,0 +1,1218 @@
+package es.optsicom.lib.util;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Collections;%0Aimport java.util.Comparator;%0Aimport java.util.List;%0A%0Apublic class RandomSorter %7B%0A%0A%09public static %3CE%3E List%3CE%3E sort(List%3CE%3E items, Comparator%3CE%3E comparator, float alpha) %7B%0A%09%09List%3CE%3E iterableList = new ArrayList%3C%3E(items);%0A%09%09List%3CE%3E sortedList = new ArrayList%3C%3E();%0A%09%09%0A%09%09// Sort list using comparator%0A%09%09Collections.sort(iterableList, comparator);%0A%09%09%0A%09%09// Create sorted list using alpha%0A%09%09while (iterableList.size() %3E 0) %7B%0A%09%09%09int index = selectValue(iterableList.size(), alpha);%0A%0A%09%09%09E element = iterableList.remove(index);%0A%09%09%09sortedList.add(element);%0A%09%09%7D%0A%0A%09%09return sortedList;%0A%09%7D%0A%0A%09public static %3CE%3E List%3CE%3E sort(List%3CE%3E items, float alpha) %7B%0A%09%09List%3CE%3E iterableList = new ArrayList%3C%3E(items);%0A%09%09List%3CE%3E sortedList = new ArrayList%3C%3E();%0A%0A%09%09// Create sorted list using alpha%0A%09%09while (iterableList.size() %3E 0) %7B%0A%09%09%09int index = selectValue(iterableList.size(), alpha);%0A%0A%09%09%09E element = iterableList.remove(index);%0A%09%09%09sortedList.add(element);%0A%09%09%7D%0A%0A%09%09return sortedList;%0A%09%7D%0A%0A%09private static int selectValue(int size, float alpha) %7B%0A%09%09int min = 0;%0A%09%09int max = (int) Math.ceil((size - 1) * alpha);%0A%0A%09%09return RandomManager.nextInt(min, max);%0A%09%7D%0A%0A%7D%0A

Add new util "RandomSorter"