buildfiles

This commit is contained in:
2026-04-13 08:19:53 +08:00
parent 273c8e8153
commit 51615a6859
54130 changed files with 6270898 additions and 30 deletions

20
node_modules/es-toolkit/dist/array/sampleSize.mjs generated vendored Normal file
View File

@@ -0,0 +1,20 @@
import { randomInt } from '../math/randomInt.mjs';
function sampleSize(array, size) {
if (size > array.length) {
throw new Error('Size must be less than or equal to the length of array.');
}
const result = new Array(size);
const selected = new Set();
for (let step = array.length - size, resultIndex = 0; step < array.length; step++, resultIndex++) {
let index = randomInt(0, step + 1);
if (selected.has(index)) {
index = step;
}
selected.add(index);
result[resultIndex] = array[index];
}
return result;
}
export { sampleSize };