mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
Clarify max size of _.sampleSize. [ci skp] [closes #1802]
This commit is contained in:
@@ -7921,7 +7921,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets `n` random elements from `collection`.
|
* Gets `n` random elements at unique keys from `collection` up to the
|
||||||
|
* size of `collection`.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -7931,8 +7932,11 @@
|
|||||||
* @returns {Array} Returns the random elements.
|
* @returns {Array} Returns the random elements.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.sampleSize([1, 2, 3, 4], 2);
|
* _.sampleSize([1, 2, 3], 2);
|
||||||
* // => [3, 1]
|
* // => [3, 1]
|
||||||
|
*
|
||||||
|
* _.sampleSize([1, 2, 3], 4);
|
||||||
|
* // => [2, 3, 1]
|
||||||
*/
|
*/
|
||||||
function sampleSize(collection, n) {
|
function sampleSize(collection, n) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
|
|||||||
Reference in New Issue
Block a user