Random Integer (watdafox)
A random number with an off switch
- result_integer
- str_result_integer
The whole pitch is in the one input the stock random nodes don't give you: random_on_off. When it's on, Random Integer picks a fresh value in [min_value, max_value] on every queue. Flick it off and it silently becomes a passthrough, returning your integer input unchanged.
That toggle is the killer feature, because it turns a "random seed" node into a reproducibility switch. You're iterating on a prompt and want to see variety - random stays on, every run differs. You find a result you like and want to tweak CFG without the composition changing - flip random_on_off off and the seed freezes in place (whatever value it last rolled stays in the widget), so your next runs are deterministic while you dial in the rest. Most of the time people achieve this by laboriously copying a seed into a KSampler; this node makes it a checkbox.
How it works
Simple and honest under the hood. When random_on_off is true, it swaps min/max if they're backwards and returns random.randint(min, max). Unlike the pack's CyclicInteger, it makes no effort to avoid repeating a value - it's fine rolling the same seed twice. When the toggle is false it returns the input integer untouched. IS_CHANGED returns "always changed" only when randomization is on (or the range is degenerate), so a disabled node doesn't force downstream re-runs. Like CyclicInteger, it reports its result back into its own integer widget through the pack's web extension, so what you see is what ran.
The inputs and outputs that matter
random_on_off- the switch. On = reroll every run, off = passthrough.min_value,max_value- the roll range (defaults 1–3).integer- the current value / passthrough source.- Outputs
result_integer(INT) andstr_result_integer(STRING). Wireresult_integerinto a KSampler'sseedinput for the classic random-batch setup.
Category: watdafox/number.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/OhSeongHyeon/comfyui-watdafox-nodes.git
Restart ComfyUI, or use ComfyUI Manager (search "comfyui-watdafox-nodes"). No pip dependencies, no model files.
Honest differences from the sibling
If you want cycling (1, 2, 3… wrap around) rather than randomness, CyclicInteger's increment/decrement modes are the right tool. If you specifically want to guarantee you never roll the same value twice in a row, CyclicInteger's randomize mode has that guard built in; RandomInteger doesn't. Pick by behavior, not by which name sounds cooler.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| integer | INT | 1-2147483648–2147483647 | — |
| random_on_off | BOOLEAN | true | — |
| min_value | INT | 1-2147483648–2147483647 | — |
| max_value | INT | 3-2147483648–2147483647 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| result_integer | INT | — |
| str_result_integer | STRING | — |