clean-jsdoc-theme TypeDoc APIv0.0.0

shuffle

shuffle<T>(array: T[]): T[]

Source: array.ts:222

Shuffles an array using Fisher-Yates algorithm

Type Parameters

  • T — Array element type

Parameters

  • array (T[]) — The input array

Returns

  • T[] — New shuffled array (does not modify original)

Example

CODE
shuffle([1, 2, 3, 4, 5]) // [3, 1, 5, 2, 4] (random order)