Nodes/ComfyUI Ino Nodes/Ino Random Int In Range
ComfyUI Node

Ino Random Int In Range

Random integers with zero-padded strings — batch naming without the ugly gaps

By nobandegani·Created about a year ago·Updated 2 months ago· 6
Ino Random Int In Range
    • random_int
    • formatted_int
    enabledtrue
    int_min0
    int_max999999
    length1

    Random integers are everywhere in ComfyUI workflows: picking a random seed, choosing one of several prompts, adding variety to batch runs. Ino Random Int In Range does the plain version of that - random.randint(min, max) - and then does something the plain version doesn't: it gives you a zero-padded string of the result. That's the feature that makes it a batch-naming tool instead of just a random number.

    Why does padding matter? Because file_7.png sorts next to file_70.png in a file browser, and file_007.png sorts where you actually want it. If you're generating a batch and saving with a name like batch_{formatted_int}, feeding the padded string into your save node keeps your outputs in order and looking consistent. That's the entire difference between this node and a bare int random - but it's a difference you'll feel at file 9 of 100.

    How it works

    Nothing hidden. It picks random.randint(int_min, int_max) and pads the result with leading zeros up to length using str.zfill(). Both the raw int and the padded string come out, so you can use whichever the downstream node needs. When enabled is off it returns -1 and an empty string - the Ino pack's universal disable behavior, which lets you kill randomization from a single toggle without rewiring.

    Inputs and outputs that matter

    • int_min / int_max - the range, both bounded 0–999999.
    • length - total padded width, 1–10. length = 4 turns 7 into "0007". Default 1 (no padding).
    • enabled - off returns -1 / "".

    Outputs: random_int (INT, the raw number) and formatted_int (STRING, the padded version).

    Installing it

    Part of ComfyUI-InoNodes (Inoland). ComfyUI Manager → search "ComfyUI Ino Nodes" → install → restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/nobandegani/comfyui_ino_nodes
    cd comfyui_ino_nodes
    pip install -r requirements.txt
    

    Restart after. Standard pack requirements: inopyutils auto-installed, current ComfyUI, no keys or model downloads.

    Common issues

    Two small traps. First, the length default of 1 means no padding - if you set up the node and filenames come out unpadded, check length, not the node's health. Second, the int and the string come from the same random draw, so wiring both into a filename won't give you mismatched values - but re-running the workflow draws a new number every time unless you pin it. That's the feature (variety) and also the gotcha (filenames change each run); if you need a stable name across runs, capture random_int into a seed or fixed value instead of letting it re-randomize.

    CategoryInoIntHelper

    Inputs (4)

    NameTypeDefaultDescription
    enabledBOOLEANtrue
    int_minINT00–999999
    int_maxINT9999990–999999
    lengthINT10–10

    Outputs (2)

    NameTypeDescription
    random_intINT
    formatted_intSTRING