Random Number Gen
Reproducible randomness — a weirder phrase than it should be
- float_val
- int_val
You want random values in your workflow - random strength, random CFG, random noise in a parameter - but you also want the exact same random values next time you run. That's the deal Random Number Gen makes: it rolls a number between a min and max, seeded, so the same seed always produces the same number. Reproducible randomness is what keeps ComfyUI workflows shareable, and this node bakes it in.
It's part of DebugPadawan's ComfyUI Essentials, a pure-Python utility pack. The randomness lives entirely in the pack - no API, no system entropy needed beyond what Python's random module uses.
How it works
Four required inputs:
seed- the reproducibility key (INT, default 0)min_val- the bottom of the range (FLOAT, default 0)max_val- the top (FLOAT, default 1)mode- dropdown:floatorint
Two outputs (both always produced, regardless of mode):
float_val- the result as a FLOATint_val- the result as an INT
The implementation creates its own random.Random(seed) instance per call and draws from it - that's the reproducibility. float mode uses uniform(min, max); int mode uses randint(int(min), int(max)). One detail worth knowing: randint is inclusive of both ends, so int mode between 1 and 6 can give 1 or 6 - it's a dice roll, not a 1-to-5.
Because the generator is created fresh from the seed every time, you don't have to worry about other random nodes in your graph interfering. Change the seed, get different values. Keep it, get the same ones.
Where you'll use it
- Parameter jitter. Randomize a strength or CFG within a sane band to explore variations, while keeping each run reproducible via the seed.
- Feeding
Number Compare. Roll a 0–1 value and compare it to a threshold for percentage-based branching (e.g. "30% of the time, do the detail pass"). - Seed sweeps. Pair with
Number Rangefor structured exploration, or just randomize and let the seed hold things together.
Installing it
One install for all nodes. ComfyUI Manager, searching for "DebugPadawans-ComfyUI-Essentials," or:
cd ComfyUI/custom_nodes
git clone https://github.com/DebugPadawan/DebugPadawans-ComfyUI-Essentials
Then restart ComfyUI. The pack's requirements (numpy, torch, opencv-python) are already in stock ComfyUI; no model downloads, nothing heavy. Don't confuse it with cubiq's "ComfyUI Essentials" - a different, larger pack in maintenance mode that shows up under similar search terms.
Gotchas
- The two outputs aren't "mode-consistent." In
intmode,float_valis still produced (asfloat(res)of the int). Pick one output and stick with it; don't assumefloat_valcame fromuniform()inintmode. randintincludes the max. If you want exclusive behavior, subtract 1 frommax_val.- The seed field's max is
0xffffffffffffffff- you won't hit the ceiling in practice, but you can't paste a negative seed in. - It's a small pack with little community presence; the behavior here is plain enough that the code is the doc.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| seed | INT | 00–18446744073709550000 | — |
| min_val | FLOAT | 0.00 | — |
| max_val | FLOAT | 1.00 | — |
| mode | COMBO | 2 options: float, int |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| float_val | FLOAT | — |
| int_val | INT | — |