module/src/utils.js
/**
 * Return a new array that is randomly shuffled from the source array using Fisher-Yates method.
 * @return {[*]}
 */
Return a new array that is randomly shuffled from the source array using Fisher-Yates method.
Return a new array that is randomly shuffled from the source array using Fisher - Yates method .
function shuffled() {
    const array = this;
    const result = Array(length);
    const length = array.length;
    let index = -1;
    while (++index < length) {
        let rand = Math.floor(Math.random() * (index + 1));
        result[index] = result[rand];
        result[rand] = array[index];
    }
    return result;
}
function shuffled ( ) { const array = this ; const result = Array ( length ) ; const length = array . length ; let index = - 1 ; while ( ++ index < length ) { let rand = Math . floor ( Math . random ( ) * ( index + 1 ) ) ; result [ index ] = result [ rand ] ; result [ rand ] = array [ index ] ; } return result ; }
Return a new array that is randomly shuffled from the source array using Fisher-Yates method.
Return a new array that is randomly shuffled from the source array using Fisher - Yates method .