random-item
Get a random item from an array
Install
$ npm install random-item
Usage
import randomItem from 'random-item';
randomItem(['🐴', '🦄', '🌈']);
//=> '🦄'
randomItem.multiple(['🐴', '🦄', '🌈'], 2);
//=> ['🌈', '🦄']
Related
- random-int - Generate a random integer
- random-float - Generate a random float
- random-obj-key - Get a random key from an object
- random-obj-prop - Get a random property from an object
- unique-random - Generate random numbers that are consecutively unique
- unique-random-array - Get consecutively unique elements from an array
- crypto-random-string - Generate a cryptographically strong random string