typedash
Version:
modern, type-safe collection of utility functions
20 lines (19 loc) • 628 B
text/typescript
import { t as Maybe } from "./Maybe-BVpZiDsE.cjs";
//#region src/functions/shuffle/shuffle.d.ts
/**
* Returns a new array with elements randomly reordered using the Fisher-Yates algorithm.
* Does not mutate the input array.
* @param array The array to shuffle.
* @returns A new array with the same elements in a random order.
* @example
* ```ts
* shuffle([1, 2, 3, 4]) // e.g. [3, 1, 4, 2]
* shuffle([]) // []
* shuffle(null) // []
* shuffle(undefined) // []
* ```
*/
declare function shuffle<T>(array: Maybe<readonly T[]>): T[];
//#endregion
export { shuffle as t };
//# sourceMappingURL=shuffle-DtVgzpV8.d.cts.map