LogicUtil_Uniform Random Int
A whole random number, on a seed, when you need to roll an index or a seed
- INT
ComfyUI is full of places where a whole number matters - seeds, list indices, step counts - and LogicUtil_Uniform Random Int is the node that rolls one for you, reproducibly. It picks an integer between min_val and max_val using random.Random(seed).randint(), so the same seed always gives the same integer. It's part of the LogicUtil subpack of ComfyUI-JDCN, and it's the natural companion to the pack's random choice node: one picks from a text list, this one rolls a number.
How it works
Three inputs, one output, no surprises:
min_valandmax_val(INT, both inclusive) - the range you're rolling in.seed- the reproducibility dial. Same seed, same number, forever.- Output:
INT, ready to feed into anything expecting a whole number.
Both bounds are inclusive, so min_val=1, max_val=3 can roll 1, 2, or 3. And there's the same fallback its float sibling has: if min_val is greater than max_val, it returns min_val instead of erroring or swapping. It won't crash on you, but it also won't do what you meant - check your order.
Why you'd reach for it
Two classic jobs. The first is generating seeds: wire the INT output into your KSampler's seed input (converted or directly if the socket accepts it), and every run gets a fresh seed while staying reproducible - change the seed input to get a new roll, leave it fixed to replay a run. That's the "lock the seed, change one variable" discipline applied in reverse: the random node is the variable you're changing.
The second is picking an index. If you've got a list of options being navigated by index (say, via the pack's String List to Combo), a random int is the dynamic index that makes the pick vary per run. Between this and the choice node you can cover both styles: pick from a list, or roll a number and index into one.
One honest caveat: this rolls uniformly, so every integer in the range is equally likely. If you want weighted odds, this isn't the node. And while it's random, remember it's seeded random - if your workflow suddenly stops varying, check whether something upstream is pinning the seed to a constant.
Installing it
It ships with ComfyUI-JDCN, so one install covers the whole pack. ComfyUI Manager: Install Custom Nodes → search "JDCN", install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/daxcay/ComfyUI-JDCN.git
cd ComfyUI-JDCN
pip install -r requirements.txt
Only dependency is piexif; no models to download. It's a small two-person hobbyist pack (Daxton Caylor and Jerry Davos), and the random nodes are the pieces of it that earn a place in real workflows. Simple, seeded, and honest about what it does - a rare combination in this ecosystem.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| min_val | INT | 0-999999999–999999999 | — |
| max_val | INT | 1-999999999–999999999 | — |
| seed | INT | 00–9999999999 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |