Files
NapCatQQ/.pnpm-store/v3/files/7f/ea5828bad54ad7aa0a91a4dced55afa4418b4c8d6c7ba54a4f50202a60f79152088e375ad24331714f5e0bdab11b6a1d9cf47083e27dc5fc7776f3645e7c5f
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

18 lines
498 B
Plaintext

import baseClamp from './_baseClamp.js';
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), baseClamp(n, 0, array.length));
}
export default arraySampleSize;