UNPKG

deep-random-pick

Version:

Picks a pseudo-random item from a pool in several ways, including a recursive method that allows for more control over probability.

10 lines (8 loc) 208 B
import { arrayPick } from './arrayPick'; export const shallowPick = (...pool) => { if (pool.length > 1) { return arrayPick(pool); } else { return arrayPick(pool[0]); } }