1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
private static List< Shop > randomSort(List< Shop > inList) { int numItems = inList.size(); List< Shop > outList = new ArrayList< Shop >(); Integer[] randomNumbers = new Integer[numItems]; int itm = 0; int cm = 0; while( cm < numItems ) { itm = new Double(Math.random() * numItems).intValue(); if( randomNumbers[itm] == null ) { randomNumbers[itm] = cm++; } } for( int i = 0 ; i < numItems ; i++ ) outList.add(inList.get(randomNumbers[i])); return outList; } |