Random Integer in Range (Legacy)
A random integer you can actually lock down and replay
- random_integer
Somewhere in almost every workflow there's a "roll a random number between these bounds and feed it to something" moment - a random strength for a controlnet, a random LoRA weight, a random pick from a set. ComfyUI core gives you seeds that randomize, but a plain integer roll that you can replay takes a bit more. Random Integer in Range (Legacy) is that: minimum, maximum, seed in, one integer out, fully deterministic for a given seed.
The mechanism is the point, so let's be honest about it: it's random.Random(seed).randint(min, max), nothing more. Python's random module is deterministic given the same seed, which means the node is reproducible run-to-run - the same seed always yields the same integer. That's what makes it useful in a way that a raw seed widget isn't: you can fix a seed, get a value, and come back to it later without having memorized the number.
The inputs that matter
- minimum / maximum - the bounds. It doesn't care which is bigger; it swaps them internally, so
1..10and10..1both work. Full signed 64-bit range, so you can roll something huge if you need it. - seed - the reproducibility knob. This one has
control_after_generateattached, just like a KSampler seed, so it can randomize on its own if you leave it. Lock it tofixedwhen you want the value to stay put. The standard ComfyUI footgun applies: if you leave the control onrandomize, the shown seed is the next one, not the one that produced your current result.
The output
A single random_integer (INT). Wire it into any converted integer input - a scale factor, a strength, an index into a list - or into another node that consumes primitives. Because it's a proper INT socket, it fans out to as many consumers as you like without the "one value typed in five places" drift.
Installing it
This one lives in silveroxides/ComfyUI-UtilsCollection. ComfyUI Manager → search ComfyUI-UtilsCollection → install → restart, or clone it by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection
Restart after cloning. Requirements are just opencv-python and typing-extensions - nothing model-related, no downloads. The "(Legacy)" suffix again means this is a compatibility alias for the pack's canonical UC_IntegerRangeRandom; you may see the newer name in the menu.
Where people get burned
The reproducible-seed thing is the main trap in reverse: people assume any "random" node is non-deterministic and don't realize this one replays. If you're deliberately rolling a fresh value every run, make sure the seed's control_after_generate is set to randomize - with it on fixed, you'll quietly get the same integer forever, which is either exactly what you wanted or a subtle bug depending on your workflow. And since randint is inclusive on both ends, 1..10 can return 10, which trips people up when they're using the output as a list index and their list has 9 items.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| minimum | INT | -9223372036854776000–9223372036854776000 | — |
| maximum | INT | -9223372036854776000–9223372036854776000 | — |
| seed | INT | -9223372036854776000–9223372036854776000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| random_integer | INT | — |