• Gets a random element from collection.

    Type Parameters

    • T

    Parameters

    • collection: readonly [T, T]

      The collection to sample.

    Returns T

    Returns the random element.

  • Type Parameters

    • T

    Parameters

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

    Returns undefined | T

    _.sample

  • Type Parameters

    • T extends object

    Parameters

    • collection: undefined | null | T

    Returns undefined | T[keyof T]

    _.sample