Package Exports
- random-pick-js
- random-pick-js/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (random-pick-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
random-pick-js
Picks random items from an array within given weights
Installation
npm i random-pick-jsUsage
import { randomPick } from 'random-pick-js'
const picked = randomPick(['icecream', 'cookie', 'anything', 'chicken', 'pizza'], {
cnt: 2,
weights: [1, 3, 10, 2, 7]
});
console.log(picked); // example output: ['anything', 'chicken']