/** * Gets a random element from collection. * * @template T * @param {readonly [T, ...T[]]} collection - The collection to sample. * @returns {T} Returns the random element. * * @example * sample([1, 2, 3, 4]); * // => 2 */ declare function sample(collection: readonly [T, ...T[]]): T; /** * Gets a random element from collection. * * @template T * @param {Record | Record | null | undefined} collection - The collection to sample. * @returns {T | undefined} Returns the random element. * * @example * sample({ 'a': 1, 'b': 2, 'c': 3 }); * // => 2 */ declare function sample(collection: Record | Record | null | undefined): T | undefined; /** * Gets a random element from collection. * * @template T * @param {T | null | undefined} collection - The collection to sample. * @returns {T[keyof T] | undefined} Returns the random element. * * @example * sample({ 'a': 1, 'b': 2, 'c': 3 }); * // => 2 */ declare function sample(collection: T | null | undefined): T[keyof T] | undefined; export { sample };