@jossmac/lil-libs
    Preparing search index...

    Function randomShuffle

    • Returns a randomly shuffled copy of items without mutating the source array.

      • T
      • items: T[]

        Array to copy and shuffle; the original is not modified.

      A Fisher–Yates shuffled copy of items.

      const items = [1, 2, 3, 4];
      const shuffled = randomShuffle(items);
      shuffled; // e.g. [3, 1, 4, 2]
      items; // [1, 2, 3, 4] (unchanged)