Function randomItem

  • Select a random item from an array

    Type Parameters

    • const T extends readonly unknown[]

    Parameters

    • array: T

      The array to select an item from

    Returns T[number]

    A randomly selected item from the array