/**
* Number generator.
*
* Supported forms:
*
* - ``
* - ``
* - ``
* - ``
*
* Produces a uniform-random integer in [MIN, MAX] (inclusive at both
* ends — mirrors the prototype semantics). Multi-range form first
* picks one declared range uniformly, then picks uniformly inside that
* range. Optional `length` pads numeric range output with leading zeros
* to the given width.
*
* When `value` is omitted, the generator emits a digit string. Without
* `length`, it emits one digit (0-9). With `length`, the result has the
* selected number of digits. This mode is intentionally string-based,
* so lengths far beyond JavaScript's safe integer range are fine.
*
* This is the primary numeric generator used outside sequences —
* inside sequences it goes through the shared dispatch in
* src/sequence/build.ts.
*/
import type { Generator } from './generator.js';
export interface NumberGenAttrs {
readonly range?: string | undefined;
readonly length?: number | string | undefined;
readonly percent?: string | undefined;
readonly firstZero?: boolean | undefined;
readonly include?: string | undefined;
readonly exclude?: string | undefined;
readonly decimals?: number | string | undefined;
}
export interface NumberRange {
readonly min: number;
readonly max: number;
readonly width?: number;
}
interface Interval {
min: number;
max: number;
}
/**
* Parse an include/exclude list: comma-separated tokens, each a single
* integer (`3`) or an inclusive range (`40..60`). Used to add/remove
* integer values from a numeric range.
*/
export declare function parseNumberIntervalList(source: string, label: string): Interval[];
/**
* Compute the allowed integer intervals for `(base ∪ include) − exclude`.
* Returns disjoint, size-weighted-selectable intervals, or throws when the
* result is empty. Pure interval math — never enumerates values, so it is
* efficient even for astronomically large ranges.
*/
export declare function computeAllowedIntervals(base: readonly NumberRange[], include: string | undefined, exclude: string | undefined): Interval[];
export interface NumberLengthChoice {
readonly min: number;
readonly max: number;
}
/**
* What `value=` on a `` may say.
*
* value="bit" 0 or 1
* value="45" always 45
* value="10,20,35" one of three
* value="34..89" a range
* value="[10..20],[30..40]" two ranges
* value="0,10..20,99" mixed; brackets optional throughout
*
* ── Why the first three of those are new ────────────────────────────────────
*
* `number` used to be a generator of RANGES, not of numbers: `value="45"` and
* `value="10,20,35"` were both refused. So the only way to say "always 50", or
* "one of these numbers", was `` — a list of
* strings that happen to look numeric.
*
* That is how arithmetic ended up on the text generator. `anomaly=` has to work
* where the numbers are, the numbers had nowhere to live but `text`, and once a
* number is one item of a string list the only check left is "does this parse
* as a number" — which is inspection, not typing. A list like
* `value="hello,50,error,20"` passes that inspection and then quietly delivers
* half the anomaly rate it was asked for, because the words can never spike.
*
* Widening this grammar is the additive half of the repair: every form above is
* either what the parser already accepted or what it used to reject outright,
* so no config that runs today changes by a byte. `text` keeps everything it
* has — people have copied our own documentation — and the numeric road simply
* exists now.
*/
export declare function parseNumberRanges(source: string): readonly NumberRange[];
export declare function parseNumberLengthChoices(source: string | number): readonly NumberLengthChoice[];
/**
* Digits after the decimal point. Absent or 0 means integers, which is what
* every existing config gets.
*/
export declare function parseNumberDecimals(raw: number | string | undefined): number;
export declare function numberGenerator(attrs: NumberGenAttrs): Generator;
export {};
//# sourceMappingURL=number.d.ts.map