/** * @module array * This module contains various functions for working with arrays - [see the documentation for more info](https://github.com/Sv443-Network/CoreUtils/blob/main/docs.md#arrays) */ /** Describes an array with at least one item */ export type NonEmptyArray = [TArray, ...TArray[]]; /** Returns a random item from the passed array */ export declare function randomItem(array: TItem[]): TItem | undefined; /** * Returns a tuple of a random item and its index from the passed array * Returns `[undefined, undefined]` if the passed array is empty */ export declare function randomItemIndex(array: TItem[]): [item?: TItem, index?: number]; /** Returns a copy of the array with its items in a random order */ export declare function randomizeArray(array: TItem[]): TItem[]; /** Returns a random item from the passed array and mutates the array to remove the item */ export declare function takeRandomItem(arr: TItem[]): TItem | undefined; /** Returns a random item and its index as a tuple from the passed array and mutates the array to remove the item */ export declare function takeRandomItemIndex(arr: TItem[]): [item?: TItem, index?: number];