@cjser/random-item
v4.0.1-cjser.2
Published
Get a random item from an array
Downloads
76
Maintainers
Readme
random-item
Get a random item from an array
Install
$ npm install random-itemUsage
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
cjser
This package is a CommonJS-compatible build generated by cjser for projects that still need require() support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.
Original repository: https://github.com/sindresorhus/random-item
