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

    Function randomShuffler

    • Creates a function that returns a newly shuffled copy on each call.

      • T
      • items: T[]

        Source array; captured by the returned function and not mutated.

      A zero-argument function that returns a fresh shuffled copy on each call.

      const items = [1, 2, 3, 4];
      const shuffleNow = randomShuffler(items);
      shuffleNow(); // shuffled copy each call