Random Prompts
Random Prompts (DPRandomGenerator)
- STRING
This is the node you actually came for. Random Prompts is the ComfyUI home of the {blue|red|green} bracket syntax and the __wildcard__ file lookups that Auto1111 users have been leaning on for years. You type a prompt with a few slots of variation in it, and on each run the node rolls the dice and hands a finished string down the line. Batch it, and you get variety without rewriting your prompt thirty times.
If you've ever seen someone post "a young woman with {brown|blonde|black} hair while it is {raining|windy|snowing}" and batch 32 of them to build a character reference sheet, that's this. It's old A1111 wildcard syntax that a lot of people who arrived after 2024 never learned, and it's genuinely one of the highest-leverage tricks for generating variety with zero training.
How it works
Two pieces of syntax do the heavy lifting. Variants are inline choices in curly braces - {a|b|c} picks one at random. You can nest them, weight them, and ask for more than one: {2$$a|b|c} pulls two. Wildcards are the __name__ form, which reads a random line out of a file called name.txt (or .json/.yaml) sitting in the pack's wildcards folder. So __hairstyle__ on a wildcards file with fifty hairstyles gives you a random one each run, and you can keep reusing it across prompts. This is the standard Dynamic Prompts syntax, ported straight into ComfyUI by the same author.
Inputs and outputs
Three inputs, and only one you'll fuss with day to day:
text- your prompt, with variants and wildcards baked in. Multiline, so write it like a normal prompt.seed- controls the roll. Same seed, same result. This is the one people trip on (more below).autorefresh-Yes/No, forces the node to regenerate every time the graph runs.
The output is a single STRING. Wire it into the text slot of a CLIP Text Encode node - positive or negative, both work fine - and carry on building your workflow as usual. Nothing about the rest of your graph changes; the node just swaps a static prompt for a rolled one.
Installing it
Easiest path is ComfyUI Manager: open Install Custom Nodes, search dynamicprompts, hit install, restart. Manual is a few more steps because this pack has real Python dependencies and a setup script:
git clone https://github.com/adieyal/comfyui-dynamicprompts custom_nodes/comfyui-dynamicprompts
python -m pip install -r custom_nodes/comfyui-dynamicprompts/requirements.txt
python custom_nodes/comfyui-dynamicprompts/install.py
mkdir custom_nodes/comfyui-dynamicprompts/wildcards
Then restart ComfyUI. That wildcards folder is where your .txt files go - the node won't find __anything__ until it exists. There are pre-built collections worth grabbing (the sd-dynamic-prompts repo ships a bunch, and there are Civitai wildcard packs), or just make your own text files, one option per line.
Where people get burned
The classic gotcha: you queue the same graph twice and get the identical prompt. That's not a bug, it's ComfyUI caching. The node only re-rolls when an input changes, and if your seed is fixed at 0, nothing changes. Two fixes - feed the seed from a randomizing primitive so it moves every run, or set autorefresh to Yes to force a fresh roll each time. Pick one and the "why is it stuck" confusion evaporates.
Second: wildcards that resolve to nothing. __hairstyle__ prints literally as __hairstyle__ in your image if there's no hairstyle.txt in the wildcards folder, or if you installed via Manager and never created the folder. Check the filename matches exactly (no extension in the prompt, extension on disk) and that it's in the pack's own wildcards directory, not ComfyUI's root.
Last thing worth knowing: the generated prompt only shows up in your console by default. If you want to see what got rolled - which you will, for debugging - chain the output into the pack's OutputString node, which prints it on the canvas. Beats squinting at a terminal.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| seed | INT | 0 | — |
| autorefresh | COMBO | No | 2 options: Yes, No |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |