MCPcopy
hub / github.com/vercel/hyper / arraySampleSize

Function arraySampleSize

bin/yarn-standalone.js:10166–10168  ·  view source on GitHub ↗

* 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.

(array, n)

Source from the content-addressed store, hash-verified

10164 * @returns {Array} Returns the random elements.
10165 */
10166 function arraySampleSize(array, n) {
10167 return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
10168 }
10169
10170 /**
10171 * A specialized version of `_.shuffle` for arrays.

Callers

nothing calls this directly

Calls 3

shuffleSelfFunction · 0.85
copyArrayFunction · 0.85
baseClampFunction · 0.85

Tested by

no test coverage detected