Nodes/ComfyUI JMNodes/Create List of Numbers JM
ComfyUI Node

Create List of Numbers JM

The Driver Node That Batch-Runs Every Prompt Combination

By JustinMatters·Created 2 years ago·Updated 2 years ago· 0
Create List of Numbers JM
    • INT
    input_integer0

    "Create List of Numbers JM" sounds like the most boring node in the pack, and mechanically it kind of is. But it's the engine that makes the whole combinatorial-prompt trick run. You set one number, it emits a list of every integer from 0 up to that number, and - because of a flag ComfyUI honors - the whole rest of your graph executes once per item in that list. That's how you turn "one counter" into "a full batch of every prompt combination."

    The context: if you've got a handful of prompt fragments you want to mix exhaustively - say a subject, a lighting phrase, and a mood - ComfyUI's built-in {a|b|c} wildcard syntax picks one per run at random. Fine for dice-rolling, useless when you want the complete, reproducible sweep. JMNodes' answer is to encode each combination as a binary number, and this node is the source of those numbers.

    How it works

    The code is exactly as simple as the name: list(range(input_integer + 1)). Feed it 7, get [0, 1, 2, 3, 4, 5, 6, 7]. The real magic is the OUTPUT_IS_LIST = (True,) flag in the node definition. That tells ComfyUI the output isn't a single value to pass along - it's a list to iterate, so every node downstream runs once per element. Downstream, Integer to Boolean Values JM converts each of those numbers into its bits, and those bits toggle Switchable Prompt JM gates. Three fragments? Set the counter to 7 and you get all eight on/off arrangements in one batch. Four fragments, set it to 15.

    The input and output

    One input, one output:

    • input_integer - INT, 0 to 1023, default 0, step 1. This is the count you care about, and it's the only knob on the node.
    • INT (list) - the list of integers from 0 through input_integer, wired into the input_integer socket of Integer to Boolean Values JM.

    The off-by-one is the classic stumble: the list runs 0 to n inclusive, so your batch size is input + 1, not input. Need 10 combinations? Set it to 9. People reach for 10, get 11 images, and spend five minutes wondering what broke. It didn't break.

    Installing it

    This node is part of ComfyUI JMNodes (JustinMatters/comfyUI-JMNodes). Install via ComfyUI Manager by searching "JMNodes", or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/JustinMatters/comfyUI-JMNodes
    

    Then restart ComfyUI. There's no requirements.txt and no model downloads - this is pure arithmetic, so install is instant and dependency-free. The pack was published in one go in early 2025 and hasn't needed changes since; there's essentially nothing to break.

    Common issues

    The big trap is the list-driving behavior itself. Because OUTPUT_IS_LIST reruns everything downstream, that number you set quietly multiplies your batch. Set it to 1023 and you've just asked for 1024 renders - the max, so ComfyUI will dutifully try to generate them. It's also a common source of "why is my queue suddenly huge?" questions. Start small, confirm the wiring with 3 or 7, and scale up once you trust the graph. If you only want one image, you don't want this node in the chain at all.

    CategoryJMNodes

    Inputs (1)

    NameTypeDefaultDescription
    input_integerINT00–1023

    Outputs (1)

    NameTypeDescription
    INTINT