UNPKG

gamekit-utils

Version:

Minimal, fast and useful utilities for randomness, array manipulation and math — built for games, UI logic and generative design.

9 lines (8 loc) 188 B
/** * Returns a random element from an array. * Throws an error if the array is empty. * * @example * random([1, 2, 3]); // → 2 */ export declare const random: <T>(arr: T[]) => T;