Function pick

  • Returns a randomly selected element of the array.

    See take() for a destructive version of this function.

    Type Parameters

    • T

    Parameters

    • array: ArrayLike<T>

      Pick from here. Must not be empty.

    Returns T

    A randomly selected element of the array.

    An error if the array is empty.