const getRandomValues = <TValue>(arr: TValue[]): TValue => { return arr[Math.floor(Math.random() * arr.length)] } code example
Example: javascript return a random value from an array
const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
const randomMonth = months[Math.floor(Math.random() * months.length)];
console.log("random month =>", randomMonth);