• Gets a random element from collection.

    Type Parameters

    • T

    Parameters

    • collection:
          | undefined
          | null
          | Dictionary<T>
          | NumericDictionary<T>

      The collection to sample.

    Returns undefined | T

    Returns the random element.

  • Type Parameters

    • T extends object

    Parameters

    • collection: undefined | null | T

    Returns undefined | T[keyof T]

    _.sample