Function shuffle

  • Randomizes the order of the specified array in-place, using the Fisher–Yates shuffle.

    Parameters

    • arr: any[]
    • rnd: (() => number) = Math.random
        • (): number
        • Returns a pseudorandom number between 0 and 1.

          Returns number

    Returns any[]

    the array shuffled

    Function

    Example

    shuffle(["C", "D", "E", "F"]) // => [...]