Java Shuffle Algorithm
1. Random r = new Random()
2. Copy an array in Java with Arrays.copyOf(array, array.length)
Integer[] otherArr = Arrays.copyOf(arr, arr.length);
// Other: file:///Users/aaa/myfile/bitbucket/java/Shuffle.java
// From Aron.java
public static Integer[] shuffle(Integer[] arr){
Integer len = arr.length;
Integer[] array = Arrays.copyOf(arr, len);
Random r = new Random();
Integer inxLen = len - 1;
for(int i = 0; i < len - i; i++){
Integer inx = r.nextInt(len - i);
Integer tmp = array[inx];
array[inx] = array[inxLen - i];
array[inxLen - i] = tmp;
}
return array;
}