UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

23 lines (22 loc) 553 B
import { Collection } from "./types"; /** * Gets `n` random elements at unique keys from `array` up to the * size of `array`. * * @since 5.11.0 * @category Array * @param collection The array to sample. * @param n The number of elements to sample. * @returns Returns the random elements. * @example * * ```js * sampleSize([1, 2, 3], 2) * // => [3, 1] * * sampleSize([1, 2, 3], 4) * // => [2, 3, 1] * ``` */ export declare function sampleSize<T>(collection: Collection<T>, n?: number, guard?: any): Array<T>; export default sampleSize;