Nodes/comfyui-watdafox-nodes/Cyclic Integer (watdafox)
ComfyUI Node

Cyclic Integer (watdafox)

The integer node that counts up, down, or jumps around — and never repeats a roll

By postosh·Created 9 months ago·Updated 8 months ago· 0
Cyclic Integer (watdafox)
    • result_integer
    • str_result_integer
    integer1
    moderandomize
    min_value1
    max_value3

    Cyclic Integer is the node you reach for when "give me a number" needs to mean "give me a number that does something on its own between queue runs." It has four modes - fixed, increment, decrement, randomize - and the two that earn the name "cyclic" are the interesting ones: increment and decrement wrap around within your [min_value, max_value] range instead of running away.

    That makes it a tiny workflow engine. Loop a batch of generations with seed 1, 2, 3, 4, then wrap back to 1. Walk a step count or a LoRA... no wait, it's an integer - walk a CFG, a denoise value (via a conversion node), or any numeric input up and down across queue runs. When a workflow re-queues, ComfyUI asks each node "did your output change?" and this node's IS_CHANGED returns "always changed" for anything but fixed, so the downstream samplers genuinely re-run with the new value. That's the mechanism behind the magic.

    How it works

    Read the source and it's surprisingly small. In increment mode it computes (integer - min + 1) % range + min, which is what gives you the wrap-around; decrement does the same backwards. randomize picks random.randint(min, max) - with a guard that avoids rolling the same number twice in a row (it loops up to 100 times to dodge a repeat, which is a nice touch for seed cycling). fixed just passes the incoming integer through. If you swap min and max, it silently fixes the order for you.

    One thing to know: the node pushes its result back into its own integer widget via the pack's web extension (watdafox-api event), so the value you see on screen is the value that ran. It's marked as an output node and always re-executes when not in fixed mode.

    The inputs and outputs that matter

    • mode - fixed / increment / decrement / randomize. This is the whole personality of the node.
    • min_value, max_value - the range to cycle or randomize within (default 1–3).
    • integer - the seed/start value that also gets echoed back as the current state.
    • Outputs result_integer (INT) and str_result_integer (STRING), so you can feed numeric inputs or text/logging nodes. Wire result_integer into a KSampler's seed and you've got a self-cycling batch runner.

    Category: watdafox/number.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/OhSeongHyeon/comfyui-watdafox-nodes.git
    

    Restart ComfyUI, or ComfyUI Manager → search "comfyui-watdafox-nodes". No extra dependencies, no model downloads.

    Where people get tripped up

    The most common surprise is that randomize actively avoids repeating the previous value - if you're counting on consecutive identical seeds you won't get them. And remember that "always changed" means it fires on every queue even if the range is tiny, so it never sleeps in a workflow. If you just want a random seed that re-rolls on demand, this pack's RandomInteger (with its on/off toggle) might be the simpler fit.

    Categorywatdafox/number

    Inputs (4)

    NameTypeDefaultDescription
    integerINT1-2147483648–2147483647
    modeCOMBOrandomize4 options: fixed, increment, decrement, randomize
    min_valueINT1-2147483648–2147483647
    max_valueINT3-2147483648–2147483647

    Outputs (2)

    NameTypeDescription
    result_integerINT
    str_result_integerSTRING