diginext-utils
Version:
README.md
17 lines • 515 B
TypeScript
/**
* Creates a new array with elements shuffled in random order.
* Uses the Fisher-Yates shuffle algorithm for uniform randomness.
*
* @template T - The type of elements in the array
* @param array - The array to shuffle
* @returns A new shuffled array
*
* @example
* ```ts
* shuffle([1, 2, 3, 4, 5]); // e.g., [3, 1, 5, 2, 4]
* shuffle(['a', 'b', 'c']); // e.g., ['c', 'a', 'b']
* shuffle([]); // []
* ```
*/
export declare function shuffle<T>(array: T[]): T[];
//# sourceMappingURL=shuffle.d.ts.map