source: node_modules/es-toolkit/dist/compat/array/shuffle.d.mts

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 970 bytes
Line 
1/**
2 * Randomizes the order of elements in an `array` using the Fisher-Yates algorithm.
3 *
4 * This function takes an `array` and returns a new `array` with its elements shuffled in a random order.
5 *
6 * @template T - The type of elements in the `array`.
7 * @param {T[]} array - The `array` to shuffle.
8 * @returns {T[]} A new `array` with its elements shuffled in random order.
9 */
10declare function shuffle<T>(array: ArrayLike<T> | null | undefined): T[];
11/**
12 * Randomizes the order of elements in an `object` using the Fisher-Yates algorithm.
13 *
14 * This function takes an `object` and returns a new `object` with its values shuffled in a random order.
15 *
16 * @template T - The type of elements in the `object`.
17 * @param {T} object - The `object` to shuffle.
18 * @returns {T[]} A new `Array` with the values of the `object` shuffled in a random order.
19 */
20declare function shuffle<T extends object>(object: T | null | undefined): Array<T[keyof T]>;
21
22export { shuffle };
Note: See TracBrowser for help on using the repository browser.