mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
Rename param to size.
This commit is contained in:
10
lodash.js
10
lodash.js
@@ -6584,23 +6584,23 @@
|
|||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Array} array The array to shuffle.
|
* @param {Array} array The array to shuffle.
|
||||||
* @param {number} [n=array.length] The size of `array`.
|
* @param {number} [size=array.length] The size of `array`.
|
||||||
* @returns {Array} Returns `array`.
|
* @returns {Array} Returns `array`.
|
||||||
*/
|
*/
|
||||||
function shuffleSelf(array, n) {
|
function shuffleSelf(array, size) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = array.length,
|
length = array.length,
|
||||||
lastIndex = length - 1;
|
lastIndex = length - 1;
|
||||||
|
|
||||||
n = n === undefined ? length : baseClamp(n, 0, length);
|
size = size === undefined ? length : baseClamp(size, 0, length);
|
||||||
while (++index < n) {
|
while (++index < size) {
|
||||||
var rand = baseRandom(index, lastIndex),
|
var rand = baseRandom(index, lastIndex),
|
||||||
value = array[rand];
|
value = array[rand];
|
||||||
|
|
||||||
array[rand] = array[index];
|
array[rand] = array[index];
|
||||||
array[index] = value;
|
array[index] = value;
|
||||||
}
|
}
|
||||||
array.length = n;
|
array.length = size;
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user