UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

19 lines (18 loc) 489 B
import { Collection } from "./types"; /** * Creates an array of shuffled values, using a version of the * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). * * @since 5.11.0 * @category Array * @param collection The array to shuffle. * @returns Returns the new shuffled array. * @example * * ```js * shuffle([1, 2, 3, 4]) * // => [4, 1, 3, 2] * ``` */ export declare function shuffle<T>(collection: Collection<T>): Array<T>; export default shuffle;