import { randomInt } from '../random/random' ; param array return export function shuffle < T > ( array ) { array = array . slice ( ) ; for ( let i = 0 ; i < array . length ; i ++ ) { const randomIndex = randomInt ( i , array . length - 1 ) ; [ array [ i ] , array [ randomIndex ] ] = [ array [ randomIndex ] , array [ i ] ] ; } return array ; }