typia
Version:
Superfast runtime validators with only one line
24 lines (23 loc) • 1 kB
TypeScript
/**
* Splits `total` into `count` parts, each inside `[minimum, maximum]`.
*
* Used where a format's length is the sum of its segments — an IPv4 octet spans
* one to three digits, an IPv6 group one to four — so a requested total length
* is realized by choosing how many characters each segment contributes instead
* of redrawing whole addresses and hoping one lands in the window (issue
* #2284).
*
* The caller guarantees `count * minimum <= total <= count * maximum`; each
* part is drawn from the range that still leaves the remaining parts
* satisfiable.
*/
export declare const __randomComposition: (props: {
total: number;
count: number;
minimum: number;
maximum: number;
}) => number[];
/** Draws `length` decimal digits, leading zeros included. */
export declare const __randomDigits: (length: number) => string;
/** Draws a decimal number of exactly `length` digits without a leading zero. */
export declare const __randomNumeric: (length: number) => string;