1 var sampleSize = require('./sampleSize');
3 /** Used as references for the maximum length and index of an array. */
4 var MAX_ARRAY_LENGTH = 4294967295;
7 * Creates an array of shuffled values, using a version of the
8 * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
12 * @category Collection
13 * @param {Array|Object} collection The collection to shuffle.
14 * @returns {Array} Returns the new shuffled array.
17 * _.shuffle([1, 2, 3, 4]);
20 function shuffle(collection) {
21 return sampleSize(collection, MAX_ARRAY_LENGTH);
24 module.exports = shuffle;