public static < T > void shuffle ( T [ ] array , Random rnd ) { //Implementing Fisher-Yates shuffle T tmp ; for ( int i = array . length - 1 ; i > 0 ; -- i ) { int index = rnd . nextInt ( i + 1 ) ; tmp = array [ index ] ; array [ index ] = array [ i ] ; array [ i ] = tmp ; } }
Shuffles the values of any array in place using the provided random generator .