ComfyUI Node

Create Arange

Generate a decimal parameter sweep with numpy.arange

By godmt·Created 2 years ago·Updated about a month ago· 16
Create Arange
    • FLOAT
    • PYLIST
    • length
    start0.00
    stop1.00
    step1.00

    Create Range gives you sequential integers. Create Arange is the same idea for decimals - it's numpy.arange(start, stop, step) in node form, and it's the node you want for a CFG sweep, a denoise sweep, or any parameter test where you need "7.0, 7.5, 8.0, 8.5... up to 12.0" without typing each value by hand.

    How it works

    Set start, stop, and step as floats and it generates the sequence numpy.arange would: begin at start, add step repeatedly, and stop once you'd reach or pass stop - which, like range(), the boundary itself is usually not included. Wire the FLOAT List output into a CFG or denoise input on your sampler through a List connection and you get one run per value, a clean way to A/B a parameter across a batch without a dedicated X/Y grid node.

    Worth knowing going in: numpy.arange has a well-known floating-point quirk where the number of items you get can be off by one from what you'd expect, purely because of how binary floating point represents decimals. numpy.arange(0, 1, 0.1) sometimes gives you 10 items, sometimes 11, depending on tiny rounding in how 0.1 is represented - this isn't a bug in this node, it's numpy being honest about float imprecision. If you need an exact count of values, Create Linspace sidesteps the problem entirely because it takes a count directly instead of deriving one from step size.

    The inputs and outputs that matter

    • start (default 0) - first value generated.
    • stop (default 1) - the boundary. Usually not included, per numpy.arange's own documented behavior.
    • step (default 1) - increment between values, decimal-friendly.

    Three outputs: FLOAT as a ComfyUI List (is_list: true) for per-item execution, PYLIST as one raw array value, and length, the actual item count - worth glancing at given the float-precision note above, since it tells you exactly how many values you got rather than how many you assumed you'd get.

    How to install it

    ComfyUI Manager: search "ComfyUI-List-Utils," install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/godmt/ComfyUI-List-Utils.git
    

    Restart after cloning. numpy is a hard dependency of ComfyUI itself, so there's nothing extra to install for this node specifically - it's already sitting in your environment.

    Common issues & troubleshooting

    Item count is one more or one fewer than you calculated by hand. That's the floating-point behavior described above, not a bug - numpy.arange can include or exclude a value right at the boundary depending on rounding. Check the length output rather than assuming; if you genuinely need an exact, predictable count, switch to Create Linspace, which takes num directly.

    Values have ugly-looking decimals like 7.500000000000001. Also a float-precision artifact, harmless for most purposes (a sampler doesn't care about the seventeenth decimal place) but can look alarming in a debug display. If it matters for your use case, round downstream with Any Cast or an Exec node.

    Wanted whole numbers, not decimals. Use Create Range instead - it's the integer version and doesn't carry any of numpy.arange's float-precision baggage.

    Categorylist_utils

    Inputs (3)

    NameTypeDefaultDescription
    startFLOAT0.00First value to generate.
    stopFLOAT1.00Stop boundary. This value is usually not included.
    stepFLOAT1.00Increment between values, matching numpy.arange().

    Outputs (3)

    NameTypeDescription
    FLOATFLOATGenerated values as a ComfyUI List-processing output.
    PYLISTPYLISTGenerated values as one Python list value.
    lengthINTNumber of generated items.