Pick random items from a list
Useful for making decisions, picking a winner, or anything else randomness can help you with.
$ npm install --global pick-random
$ pick-random --help
Usage
$ pick-random <arg> <arg> ... [--count <count>]
$ cat newline-separated-picks.txt | pick-random
Example
$ pick-random unicorn rainbow cake pony --count 2
pony
rainbow
$ pick-random yes no
$ pick-random $(seq 54) --count 6
$ npm install --save pick-random
var pickRandom = require('pick-random');
pickRandom(['Sindre', 'Stephen', 'Unicorn', 'Pascal', 'Addy', 'Pony'], {count: 2});
//=> ['Unicorn', 'Pony']Returns an array.
Required
Type: array
List to pick from.
Type: number
Default: 1
Number of picks.
Must be lower than the length of list.
MIT © Sindre Sorhus