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.
16 lines (15 loc) • 389 B
JavaScript
;
exports.__esModule = true;
var arrayPick_1 = require("./arrayPick");
exports.shallowPick = function () {
var pool = [];
for (var _i = 0; _i < arguments.length; _i++) {
pool[_i] = arguments[_i];
}
if (pool.length > 1) {
return arrayPick_1.arrayPick(pool);
}
else {
return arrayPick_1.arrayPick(pool[0]);
}
};