API Reference

Returns random elements from an array.

function getRandomItems<T>(arr: T[], n: number): T[]

// Example:

getRandomItems([1, 2, 3, 4, 5, 6], 1) //=> [3]

getRandomItems([1, 2, 3, 4, 5, 6], 3) //=> [2, 1, 5]