Random Number 🦬
A friendly random number generator — int, float, and boolean at once
- integer_output
- float_output
- boolean_output
Randomness is the engine of variation in ComfyUI, but most of the built-in random nodes are needlessly finicky. Random Number is the "user friendly" version: give it a minimum, a maximum, and a seed, and it hands you an INT, a FLOAT, and a BOOLEAN all at once. Whatever type your downstream node wants, there's an output waiting for it.
It's part of Sokes Nodes 🦬, and it's the pack's answer to "I just want a random number in a range, why is this so hard."
How it works
Three inputs:
- minimum / maximum - the range. Both are FLOATs, and the node doesn't care which is bigger - it swaps them if you get them backwards, so
min=10, max=1still behaves. Range is generous: ±1e18. - seed - same seed, same outputs. That's the reproducibility contract.
One random float is drawn from the range, then everything else is derived from it:
- integer_output (INT) - the float rounded to the nearest whole number.
- float_output (FLOAT) - the raw value.
- boolean_output (BOOLEAN) -
Trueif the float is above the midpoint of the range,Falseotherwise.
So with the defaults (min 0, max 1), you get either 0 or 1 as the int, a uniform float, and a coin-flip-ish boolean. The three outputs are correlated - they're one sample expressed three ways - which is usually exactly what you want when you're wiring the same "luck" into a workflow.
Install
Standard Sokes Nodes 🦬 install:
cd ComfyUI/custom_nodes
git clone https://github.com/m-sokes/ComfyUI-Sokes-Nodes.git
pip install -r requirements.txt
or ComfyUI Manager → search "ComfyUI Sokes Nodes" → Install, restart.
When it earns its keep
Variation loops, mostly. Hook float_output into a CFG scale or denoise input and sweep a range of looks per run; use integer_output to randomize batch size or steps; feed boolean_output into a conditional to occasionally flip a setting. Because it's seeded, you can reproduce any given variation set for debugging - or bump the seed to explore.
The one thing to notice: the boolean isn't an independent 50/50 flip. With min=0, max=100, boolean_output is True whenever the float is above 50 - it's "did we land in the top half," not "fair coin." If you actually want an independent yes/no, give it a range and think of the midpoint as your probability knob. Minor quirk, easy to miss, good to know.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| minimum | FLOAT | 0.00-1000000000000000000–1000000000000000000 | — |
| maximum | FLOAT | 1.00-1000000000000000000–1000000000000000000 | — |
| seed | INT | 00–18446744073709550000 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| integer_output | INT | — |
| float_output | FLOAT | — |
| boolean_output | BOOLEAN | — |