randomcryp
Version:
A cryptographically secure, feature rich, zero dependency and browser friendly random number generator library.
8 lines (7 loc) • 299 B
TypeScript
/**
* Randomly choose an element from an array-like object.
* @returns undefined if the array is empty.
* @returns a random element from the array if at least one element is present.
* @example choice([1, 2, 3]) // 2
*/
export declare const choice: <E>(choices: ArrayLike<E>) => E | undefined;