UNPKG

diginext-utils

Version:
16 lines 530 B
/** * Returns a random element from an array. * * @template T - The type of elements in the array * @param array - The array to get a random element from * @returns A random element, or undefined if array is empty * * @example * ```ts * randomElement([1, 2, 3, 4, 5]); // Random element from array * randomElement([]); // undefined * randomElement(['apple', 'banana', 'cherry']); // Random fruit * ``` */ export declare function randomElement<T>(array: T[]): T | undefined; //# sourceMappingURL=randomElement.d.ts.map