codetrix - v1.5.0
    Preparing search index...

    Function shuffle

    • Randomly shuffles the elements of an array (Fisher-Yates algorithm).

      Type Parameters

      • T

        The type of array elements.

      Parameters

      • array: T[]

        The array to shuffle.

      Returns T[]

      A new array with the elements shuffled.

      shuffle([1, 2, 3]); // e.g. [3, 1, 2]