Forger Help

Number Settings

Three options control number generation: numberMin, numberMax, and numberFloat.

Bounds

Both bounds are inclusive. By default numbers are integers between 1 and 1000:

const page = Forger.create<number>({ numberMin: 1, numberMax: 25 })!; // an integer: 1 ≤ page ≤ 25

Bounds apply to every number in the object graph, at any nesting depth:

interface Cart { itemCount: number; items: { qty: number }[]; } const cart = Forger.create<Cart>({ numberMin: 1, numberMax: 9 })!; // every qty is 1..9

Inverted bounds are auto-fixed

If numberMin > numberMax, Forger does not throw: the maximum becomes numberMin + 100.

const n = Forger.create<number>({ numberMin: 1000, numberMax: 100 })!; // 1000 ≤ n ≤ 1100

The rule protects generation from typos; tests that rely on it should instead pass a correct range.

Fractional numbers

Set numberFloat: true for fractional output; the default false floors the value:

const rate = Forger.create<number>({ numberMin: 0, numberMax: 1, numberFloat: true, })!; // 0.47213… — somewhere in [0, 1]

Fractional generation applies everywhere numbers appear, including array elements and nested objects.

Settings reference

Option

Type

Default

Notes

numberMin

number

1

Inclusive lower bound

numberMax

number

1000

Inclusive upper bound; auto-fixed if < numberMin

numberFloat

boolean

false

true keeps the fractional part

08 September 2026