1 var baseRandom = require('./_baseRandom');
4 * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
7 * @param {Array} array The array to shuffle.
8 * @param {number} [size=array.length] The size of `array`.
9 * @returns {Array} Returns `array`.
11 function shuffleSelf(array, size) {
13 length = array.length,
14 lastIndex = length - 1;
16 size = size === undefined ? length : size;
17 while (++index < size) {
18 var rand = baseRandom(index, lastIndex),
21 array[rand] = array[index];
28 module.exports = shuffleSelf;