Nodes/ComfyUI-UtilsCollection/RandomIntRange (Legacy)
ComfyUI Node

RandomIntRange (Legacy)

Randomness you can reproduce — the seed-friendly integer roller

By silveroxides·Created 2 months ago·Updated about 7 hours ago· 24
RandomIntRange (Legacy)
    • INT
    min0
    max100
    seed0

    RandomIntRange is the smarter sibling of the pack's plain RandomInt: it rolls an integer, but inside a range you pick, and the roll is seeded. Same seed, same number, every single run. That combo - bounded and reproducible - is what makes it genuinely useful instead of a party trick.

    How it works

    Under the hood it's four lines: rng = random.Random(seed), then rng.randint(min, max). Seeded PRNG means determinism: feed min=5, max=20, seed=7 and you get the same answer in every run, on every machine. Change the seed and the roll changes. randint is inclusive, so min and max are both reachable, and negatives are fine - this is a full 64-bit integer range.

    The three inputs that matter:

    • min (default 0) and max (default 100) - the inclusive bounds of the roll.
    • seed (default 0) - the one that makes it reproducible. Like a KSampler seed, it has control-after-generate, so if you leave it on the dice it randomizes every queue; the output then varies run to run, but you can always pin a seed and get back a specific result.

    Output is a single INT.

    What it's actually for

    The classic use is randomizing a sampler's step count or CFG within a sane band while keeping a workflow shareable - someone downloads your graph, and instead of a hardcoded 28 steps they get 20–35, seeded, with a single knob to pin it. It's also the go-to for grid/batch sweeps: wire the output to a batch count, set the seed to the current run index, and each run of a loop gets a different-but-loggable value. And because the roll is seeded rather than "whatever the widget feels like," you can reproduce a specific run for debugging - which plain RandomInt cannot do.

    Where people get burned

    • min > max just crashes or misbehaves - keep them sane; there's no validation that swaps them for you.
    • The seed widget randomizes by default. If you want a fixed random range (same result forever), set the seed once and leave it. If you want a fresh roll each queue, leave the dice. Both are valid; just know which one you're in.
    • It outputs an integer only. Random floats are not this node's job.
    • randint is inclusive - if you want max excluded, set it one higher and remember why.

    Installing it

    Ships in silveroxides/ComfyUI-UtilsCollection. ComfyUI Manager: search ComfyUI-UtilsCollection, install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/silveroxides/ComfyUI-UtilsCollection
    cd ComfyUI-UtilsCollection
    pip install -r requirements.txt   # opencv-python, typing-extensions
    

    Restart ComfyUI. No models, no downloads. The pack is AGPL-3.0, small and new (mid-2026), from the author of ComfyUI-ModelUtils and convert_to_quant. This legacy alias maps to canonical UC_RandIntRange; same behavior, the "(Legacy)" name just preserves old workflow references.

    Categoryutils/primitive

    Inputs (3)

    NameTypeDefaultDescription
    minINT0-9223372036854776000–9223372036854776000
    maxINT100-9223372036854776000–9223372036854776000
    seedINT00–18446744073709550000

    Outputs (1)

    NameTypeDescription
    INTINT