Pacote
    Preparing search index...

    Function shuffle

    • Returns a randomly shuffled copy of a collection using the Durstenfeld algorithm.

      The input collection is not modified.

      Type Parameters

      • T

      Parameters

      • items: readonly T[]

        Items to shuffle.

      Returns T[]

      A new array containing the same items in random order.

      import { shuffle } from '@pacote/shuffle'

      shuffle([1, 2, 3]) // => a shuffled copy of the array