Returns a random element from an array.
The array to sample from.
A single random element from the array, or undefined if the array is empty.
sample(['apple', 'banana', 'cherry']) // e.g., 'banana' Copy
sample(['apple', 'banana', 'cherry']) // e.g., 'banana'
Returns a random element from an array.