UNPKG

codetrix

Version:

A lightweight lodash-style utility library

12 lines (11 loc) 325 B
/** * Randomly shuffles the elements of an array (Fisher-Yates algorithm). * * @template T The type of array elements. * @param array The array to shuffle. * @returns A new array with the elements shuffled. * * @example * shuffle([1, 2, 3]); // e.g. [3, 1, 2] */ export declare function shuffle<T>(array: T[]): T[];