@sensimods/utility-lab
    Preparing search index...

    Function shuffle

    • Randomly shuffles an array using the Fisher-Yates algorithm. Returns a new array and does not mutate the original.

      Type Parameters

      • T

      Parameters

      • arr: T[]

        The array to shuffle.

      Returns T[]

      A new, randomly ordered array.

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