Files
lodash/_arraySampleSize.js
John-David Dalton ab95e7dde7 Bump to v4.16.2.
2016-09-25 13:40:14 -07:00

17 lines
429 B
JavaScript

import copyArray from './_copyArray.js';
import shuffleSelf from './_shuffleSelf.js';
/**
* A specialized version of `_.sampleSize` for arrays.
*
* @private
* @param {Array} array The array to sample.
* @param {number} n The number of elements to sample.
* @returns {Array} Returns the random elements.
*/
function arraySampleSize(array, n) {
return shuffleSelf(copyArray(array), n);
}
export default arraySampleSize;