diginext-utils
Version:
README.md
15 lines • 434 B
TypeScript
/**
* Returns a random index from an array.
*
* @template T - The type of elements in the array
* @param array - The array to get a random index from
* @returns A random index, or -1 if array is empty
*
* @example
* ```ts
* randomIndex([1, 2, 3, 4, 5]); // Random number between 0 and 4
* randomIndex([]); // -1
* ```
*/
export declare function randomIndex<T>(array: T[]): number;
//# sourceMappingURL=randomIndex.d.ts.map