public static void shuffle ( int [ ] arr , Random rand ) { int size = arr . length ; for ( int i = size ; i > 1 ; i -- ) { int tmp = arr [ i - 1 ] ; int r = rand . nextInt ( i ) ; arr [ i - 1 ] = arr [ r ] ; arr [ r ] = tmp ; } }
Randomly shuffles the contents of the provided array