/** * Validates a `size` argument and returns it normalised as a shape array, or `null`. * * @param {number|number[]|null|undefined} size * @returns {number[]|null} * @throws {Error} If `size` is not null, a non-negative integer or an array of them. * @private */ export function normalizeSize(size: number | number[] | null | undefined): number[] | null; /** * Builds a (possibly nested) array of the given shape calling `generator` for each element. * * @param {number[]} shape * @param {Function} generator * @returns {Array} * @private */ export function fillShape(shape: number[], generator: Function): any[]; /** * Generates random values or arrays of random values given a sampling function and a size parameter. * * @param {Function} generator - Function returning one sample on each call. * @param {number|Array|null} [size=null] - The shape of the output: * - If `null`, a single value is returned. * - If a number, a 1D array of the specified size is returned. * - If an array (e.g., [m, n]), a multidimensional array of the specified shape is returned. * @returns {*|Array} A single value, a 1D array or a nested array of the given shape. * @throws {Error} Throws an error if the `size` parameter is not a non-negative integer, an array of them, or null. */ export function baseGenerator(generator: Function, size?: number | any[] | null): any | any[];