draw
Get a random item from a list
155 bytes
Usage
Draw, as in ‘to draw a card from a deck’, is used to get a random item from an array.
import * as import _
_ from 'radashi'
const const fish: string[]
fish = ['marlin', 'bass', 'trout']
import _
_.draw<string[]>(array: string[]): string | nullexport draw
“Draw” a random item from an array. The item is not removed from
the array. Returns null if the array is empty.
draw(const fish: string[]
fish) // => a random fish