List of usage examples for java.util Collections shuffle
public static void shuffle(List<?> list)
From source file:edu.cmu.tetrad.search.TestHippocampus.java
int[] shuffle(int[] arr) { List<Integer> list = new ArrayList<Integer>(); for (int i = 1; i <= arr.length; i++) { list.add(i);/*from w w w . j a v a 2s .c o m*/ } Collections.shuffle(list); int[] arr2 = new int[arr.length]; for (int i = 0; i < list.size(); i++) { arr2[i] = list.get(i); } return arr2; }