random-item

Get a random item from an array

Usage no npm install needed!

<script type="module">
  import randomItem from 'https://cdn.skypack.dev/random-item';
</script>

README

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