UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

19 lines (18 loc) 335 B
/** * Gets a random element from `array`. * * **NOT** support object * * @since 5.7.0 * @category Array * @param array The array to sample. * @returns Returns the random element. * @example * * ```js * sample([1, 2, 3, 4]) * // => 2 * ``` */ export declare function sample<T>(array: Array<T>): T; export default sample;