Nodes/comfyui-RandomPromptsZveroboy/Random Prompts Zveroboy
ComfyUI Node

Random Prompts Zveroboy

Random prompts that don't secretly collapse into the same few choices

By thezveroboy·Created about a year ago·Updated 6 months ago· 6
Random Prompts Zveroboy
    • STRING
    text{simple|example} and {nested|{complex|example}}
    seed0
    autorefreshdisabled

    This node exists to fix a genuinely annoying failure mode: you build a prompt full of {this|that|the other} choices so a batch comes out varied, and the original dynamicprompts-style nodes quietly produce the same few combinations over and over. The choices end up correlated with each other, or one option wins almost every time, and your batch of 32 looks like a batch of 4. Random Prompts Zveroboy is a single-node reimplementation that claims to kill that correlation - and reading the code, the claim mostly holds up. It's the {a|b|c} bracket trick from the old A1111 days, which most people arriving after 2024 never learned, wrapped in a pure-Python node with no dependencies and no API.

    How it works

    The node does two passes over your prompt text. First it handles __wildcardname__ references by pulling a random line from wildcards/wildcardname.txt in the node's own folder. Then it walks the text and resolves every {choice one|choice two} block, recursing so {nested|{deeply|nested}} actually works instead of breaking on the first |.

    The interesting bit is how it picks. Instead of random.choice() on each block independently, it keeps a per-block usage history and always picks among the least-used options - a "balanced" random. That's the whole selling point: blocks stop being correlated with each other, and the rare option actually shows up. It also seeds a local random.Random() rather than touching the global RNG, which is the sort of hygiene detail that keeps it from poisoning other nodes' randomness.

    The three inputs, and the one that matters

    • text - your prompt with {choices} and __wildcards__. Default is {simple|example} and {nested|{complex|example}}, which is a fine demo.
    • seed - the one that matters. 0 means "different every run" (it reseeds from the clock each queue). Any positive number gives a reproducible result and resets the balanced-choice history when it changes. Keep it 0 for variation, lock it when you're comparing other things.
    • autorefresh - enabled/disabled. Honest gotcha: in the shipped code this dropdown doesn't actually gate anything. The node is an output node, so it re-executes on every queue run, and seed 0 is already fresh each time. It's cosmetic.

    Output: a single STRING - the rendered prompt. Wire it into a CLIP Text Encode's text input (positive, and typically negative too if you want matching variety).

    Installing it

    No requirements.txt, no model downloads, nothing to pip. It's stdlib plus ComfyUI's own folder_paths.

    cd ComfyUI/custom_nodes
    git clone https://github.com/thezveroboy/comfyui-RandomPromptsZveroboy.git
    

    Then restart ComfyUI. You can also find "comfyui-RandomPromptsZveroboy" through ComfyUI Manager's install-by-name search. Node shows up under the "zveroboy" category.

    Where people get burned

    • Wildcards live in the node's folder, not yours. The README is explicit: put your txt files in ComfyUI/custom_nodes/comfyui-RandomPromptsZveroboy/wildcards/. Put them anywhere else and the __name__ stays literally in your prompt as dead text. The node even auto-creates that folder on first load.
    • Seed 0 is the trap for reproducibility. If you set seed 0, you get fresh output every run - that's the point, but it means re-running the same workflow never gives the same prompt. When you finally land on a good one, you can't go back to it unless you'd bumped the seed.
    • The failure string is literal. If something throws while processing, the node outputs the string Error in prompt generation rather than failing loudly - so a malformed wildcard file can silently poison your batch with that text as a prompt. Check the ComfyUI console if your images start saying that.

    Is it the most polished node on the registry? No - zero impressions, one commit, and the autorefresh dead weight tell you it's a small personal fix. But the mechanism it fixes is real, the code is short enough to audit before you install, and for generating prompt variety in batches it does exactly what it says.

    Categoryzveroboy

    Inputs (3)

    NameTypeDefaultDescription
    textSTRING{simple|example} and {nested|{complex|example}}
    seedINT00–1152921504606847000
    autorefreshCOMBOdisabled2 options: enabled, disabled

    Outputs (1)

    NameTypeDescription
    STRINGSTRING