Nodes/comfyui_gr85/Random Int
ComfyUI Node

Random Int

The integer sibling to Random Float, same seeded-draw idea

By veighnsche·Created 2 years ago·Updated 8 months ago· 1
Random Int
    • random_int
    seed0
    min_value0
    max_value100

    Random Int is Random Float's sibling, minus the decimal places: seed it, give it a min and a max, and get back a reproducible random integer in that range. Same motivation as the rest of the pack's random-number corner - ComfyUI's native "randomize" control lives on a widget and isn't wireable data, so the moment you want to actually route a random value somewhere (log it, branch on it, feed it to two different nodes at once), you need a real node output instead. This is that, for whole numbers.

    Inputs. seed - the usual determinism control; same seed always reproduces the same draw. min_value and max_value set the integer range, defaulting to 0 and 100 respectively (so out of the box, it's "a random number 0–100" without touching anything). Output is a single random_int.

    What it's for. Anything that wants a whole number rather than a float: step counts, batch sizes, an index into a set of options. It pairs naturally with the pack's other prompt-selection tooling - feed a random_int into Seed Based Output Selector's seed_number if you want the selection itself to be independently randomizable rather than tied to your image's generation seed, or use it to pick a numeric parameter you'd otherwise be tempted to eyeball by hand across a batch run.

    One schema detail worth flagging. min_value and max_value here accept anywhere from -10 billion to +10 billion - well outside the 32-bit integer range (roughly ±2.1 billion) that a lot of ComfyUI's stock INT widgets are built around. If you generate a random_int near the extremes of that range and wire it into a node whose own widget caps out lower, expect a validation error on that downstream node, not on this one - it's not a bug here, this node's range is just wider than most things downstream are built to accept.

    Installing it. Same as every other node in this pack - no external dependencies, it's integer arithmetic. Search "comfyui_gr85" in ComfyUI Manager, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/veighnsche/comfyui_gr85
    

    Restart ComfyUI and it shows up under GR85/Utils.

    The usual seeded-node gotcha applies here too. Leave seed unchanged across runs and you'll get the identical integer every time - expected behavior for a reproducible node, but a common source of "why isn't this randomizing" confusion if you were expecting it to behave like a stock widget's auto-increment. And as with Random Float, there's no documented validation on min_value versus max_value - if you set them backwards, you're on your own; keep min actually less than max.

    CategoryGR85/Utils

    Inputs (3)

    NameTypeDefaultDescription
    seedINT0
    min_valueINT0-10000000000–10000000000
    max_valueINT100-10000000000–10000000000

    Outputs (1)

    NameTypeDescription
    random_intINT