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

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 500 bytes
Line 
1var baseClamp = require('./_baseClamp'),
2 copyArray = require('./_copyArray'),
3 shuffleSelf = require('./_shuffleSelf');
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
17module.exports = arraySampleSize;
Note: See TracBrowser for help on using the repository browser.