• Gets n random elements at unique keys from collection up to the size of collection.

    Type Parameters

    • T

    Parameters

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

      The collection to sample.

    • Optionaln: number

      The number of elements to sample.

    Returns T[]

    Returns the random elements.

  • Type Parameters

    • T extends object

    Parameters

    • collection: undefined | null | T
    • Optionaln: number

    Returns T[keyof T][]

    _.sampleSize