random-item
April 16, 2021 ยท View on GitHub
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