Nodes/ComfyUI-ListHelper/NumberListGenerator
ComfyUI Node

NumberListGenerator

Make number lists for batch sweeps without fighting the API

By dseditor·Created about a year ago·Updated 7 months ago· 75
NumberListGenerator
    • int_list
    • float_list
    • total_count
    min_value0.00
    max_value10.00
    step1.00
    count10
    randomfalse
    seed-1

    Every serious ComfyUI user eventually wants the same thing: generate 20 images at CFG 1, 2, 3, … 20, or sweep a denoise strength across a range, without hand-typing forty numbers. NumberListGenerator is the small node that makes that trivial. It emits a sequence of numbers as a list you can feed into anything that iterates over a batch - which is a much smoother path than the old habit of stringifying a range and hoping a parser picks it up.

    How it works

    You set a range and it walks through it. min_value starts the sequence, step advances it, and max_value is the hard upper bound. The loop stops when either count items have been produced or the next value would exceed max_value - whichever comes first. That detail matters, because it means total_count can come out smaller than the count you asked for. If you set min 0, max 10, step 2, count 100, you get 6 values (0,2,4,6,8,10), not 100.

    The random mode is a shuffle, not a sampling: it generates the same bounded sequence, then shuffles it in place, keeping int_list and float_list in matching order. Set seed to -1 for a fresh shuffle each run, or a fixed number to reproduce the exact same order (say, for an A/B test you need to rerun).

    The inputs that matter

    • min_value, max_value, step - the sequence definition. Floats, each with a ±10,000 range in the schema.
    • count - the maximum number of items (1–10,000).
    • random + seed - shuffle control.

    Outputs are the useful part: int_list and float_list (both lists, generated together from the same sequence), plus total_count - the actual number produced, which is the number of iterations your batch loop should run.

    Installing it

    cd ComfyUI/custom_nodes
    git clone https://github.com/dseditor/ComfyUI-ListHelper
    

    Restart ComfyUI; look under ListHelper/Math. No dependencies beyond the pack's base install. ComfyUI Manager: search "ComfyUI-ListHelper".

    Where people get burned

    The max_value early-stop is the trap. Because the generator stops at the ceiling rather than erroring, a step that doesn't divide the range cleanly produces fewer values than count - and if your downstream loop naively iterates count times, it'll index past the end of the list. Always wire total_count into your loop bound, not your original count. It's a one-line habit that prevents the most common batch-pipeline crash. Oh, and a heads-up: random shuffles the order of your bounded list - it won't give you 10 random values in [0, 100]. For that you'd want to set min 0, max 100, step large enough to not collide, and shuffle. Took me a minute to figure that one out.

    CategoryListHelper/Math

    Inputs (6)

    NameTypeDefaultDescription
    min_valueFLOAT0.00-10000–10000
    max_valueFLOAT10.00-10000–10000
    stepFLOAT1.000.01–1000
    countINT101–10000
    randomBOOLEANfalse
    seedoptINT-1-1–1000000

    Outputs (3)

    NameTypeDescription
    int_listINT
    float_listFLOAT
    total_countINT