Skip to content

sindresorhus/random-item

Repository files navigation

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