ixfx
    Preparing search index...

    Function shuffle

    • Returns a shuffled copy of the input array.

      Type Parameters

      • V

        Type of array items

      Parameters

      • dataToShuffle: readonly V[]
      • rand: RandomSource = Math.random

        Random generator. Math.random by default.

      Returns V[]

      Copy with items moved around randomly

      const d = [1, 2, 3, 4];
      const s = shuffle(d);
      // d: [1, 2, 3, 4], s: [3, 1, 2, 4]