Nodes/Comfy_KepListStuff/Range(Num Steps) - Float
ComfyUI Node

Range(Num Steps) - Float

Sweep a float range in an exact number of steps

By M1kep·Created 3 years ago·Updated 2 years ago· 56
Range(Num Steps) - Float
    • range
    • range_sizes
    start0
    stop0
    num_steps1

    Sometimes you don't care about the step size, you care about the count. "Give me five evenly spaced values between 0.4 and 0.8" is a different question than "step by 0.1," and Range(Num Steps) - Float is the node that answers the first one. It's the sibling of Range(Step) - Float in this pack: same job, different control. Step-based ranges ask "how far between values?", this one asks "how many values total?"

    The inputs are start (FLOAT), stop (FLOAT), and num_steps (INT, 1–4096). The outputs are range - your list of floats - and range_sizes, an INT list giving the length of each run the node built. Set start 0.4, stop 0.8, num_steps 5, and you get five values evenly dividing that span.

    Where this earns its keep is sweeps where a "nice" step size doesn't exist. Denoise strength 0.3→0.7 in four even jumps, CFG 5→9 in five, a LoRA weight ramp - the kind of thing where you'd otherwise do the division in your head and hand-type a list. In the pack's XY workflow, this is the float-axis generator feeding XYAny.

    Two mechanics worth knowing. First, unlike its step-based sibling, this node has no end_mode - there's no exclusive option, and the last generated value lands on stop. Second, it does its arithmetic in Decimal, not binary floats, which matters more than it sounds: naive float stepping drifts (0.1 + 0.2 ≠ 0.3 in binary), and Decimal keeps your sweep values clean all the way down the list. That's the same design as Range(Step) - Float, and it's the reason you don't get ugly 0.30000000000000004 entries polluting your CFG axis.

    Now the trap, and it mirrors a bug in the int version of this node: the default num_steps is 1, and num_steps = 1 divides by zero ((stop - start) / (num_steps - 1)), so the node crashes with a ZeroDivisionError if you leave it alone. It's an odd default to ship, but the fix is one keystroke - just set a real count before you run. Any value ≥ 2 is safe.

    It's list-aware like the rest of the pack, so you can feed lists of starts/stops and get multiple concatenated sweeps, with range_sizes telling you where each one begins and ends for grid slicing.

    Install is the same for the whole pack - zero extra dependencies, no model files:

    cd ComfyUI/custom_nodes
    git clone https://github.com/M1kep/Comfy_KepListStuff
    

    Restart ComfyUI or grab Comfy_KepListStuff from Manager, and look under List Stuff. Set a num_steps above 1, and sweep.

    CategoryList Stuff

    Inputs (3)

    NameTypeDefaultDescription
    startFLOAT0-4096–4096
    stopFLOAT0-4096–4096
    num_stepsINT11–4096

    Outputs (2)

    NameTypeDescription
    rangeFLOAT
    range_sizesINT