1

2

3


function randInt(n) {
  const max = Math.floor(4294967296 / n) * n;
  const a = new Uint32Array(1);
  do { crypto.getRandomValues(a); }
  while (a[0] >= max);   
  return a[0] % n;
}


function pick(pool, k) {
  const p = [...pool], out = [];
  for (let i = 0; i < k; i++)
    out.push(...p.splice(randInt(p.length), 1));
  return out;
}