UNPKG

super-utils-plus

Version:

A superior alternative to Lodash with improved performance, TypeScript support, and developer experience

23 lines (22 loc) 658 B
/** * Creates an array of shuffled values using a version of the Fisher-Yates shuffle. * * @param array - The array to shuffle * @returns The shuffled array */ export declare function shuffle<T>(array: T[]): T[]; /** * Gets a random element from an array. * * @param array - The array to sample from * @returns The sampled element */ export declare function sample<T>(array: T[]): T | undefined; /** * Gets `n` unique random elements from an array. * * @param array - The array to sample from * @param n - The number of elements to sample * @returns The sampled elements */ export declare function sampleSize<T>(array: T[], n?: number): T[];