source: imaps-frontend/node_modules/lodash-es/_arraySampleSize.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 498 bytes
RevLine 
[d565449]1import baseClamp from './_baseClamp.js';
2import copyArray from './_copyArray.js';
3import shuffleSelf from './_shuffleSelf.js';
4
5/**
6 * A specialized version of `_.sampleSize` for arrays.
7 *
8 * @private
9 * @param {Array} array The array to sample.
10 * @param {number} n The number of elements to sample.
11 * @returns {Array} Returns the random elements.
12 */
13function arraySampleSize(array, n) {
14 return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
15}
16
17export default arraySampleSize;
Note: See TracBrowser for help on using the repository browser.