Get a random element from array
Typescript
ts
export function randomElement<T>(array: T[]): T {
return array[Math.floor(Math.random() * array.length)];
}
ts
export function randomElement<T>(array: T[]): T {
return array[Math.floor(Math.random() * array.length)];
}