public static < E > void shuffle ( E [ ] array ) { int swapPlace = - 1 ; for ( int i = 0 ; i < array . length ; i ++ ) { swapPlace = ( int ) ( Math . random ( ) * ( array . length - 1 ) ) ; TrivialSwap . swap ( array , i , swapPlace ) ; } }
Randomly shuffle the elements in an array