EBU PromptHelper Randomize
The bracket trick, but as a node with weighted odds
- updated_prompt_text
- word_selected
Randomize is the heart of this pack and the node that turns a static prompt into a slot machine. You write a prompt with a placeholder token in it, give the node a list of replacement options, and every run it swaps the token for a randomly chosen option. If you've seen the A1111-style bracket trick - {brown|blonde|black} hair - this is the node-based version, with one big upgrade: each option can carry a weight, so "red dress" can be three times as likely as "green dress." The pack's whole pitch - variety across batches without hand-writing prompts - runs through this node first.
How it works
Three steps, and each one has a setting. First, split your replacement_options using the delimit_options_with dropdown (newlines, commas, or semi-colons) - so you can paste a comma-separated list straight in. Second, apply the weighted syntax: any option prefixed with N>> gets N tickets in the draw. 3>>red is three times as likely as an unweighted option, and the prefix is stripped before replacement, so the prompt gets red, not 3>>red. Third, swap the placeholder: every occurrence of word_to_replace in prompt_text is replaced with the winner. You can give multiple placeholder words separated by | (e.g. red|blue|yellow) and all of them get the same drawn option, which is handy for keeping a scene's accent color consistent.
The inputs that matter
- prompt_text - your prompt containing the placeholder(s).
- word_to_replace - the token, e.g.
MY_ANIMAL; multiple tokens via|. - replacement_options - the pool to draw from, with optional
N>>weighting. - seed - 0 for non-deterministic; a fixed seed reproduces the exact pick.
- case_sensitive - default true. Flip it off and the replacement matches case-insensitively.
- delimit_options_with - how to split the options.
Outputs: updated_prompt_text (the prompt with the swap done) and word_selected (what was drawn - wire this to a preview node or logger if you want to see the dice). Note that word_selected is the raw chosen option, after the weight prefix is removed.
Where it fits
The example Flux workflow uses Randomize for animals and locations - MY_ANIMAL draws from dog; cat; lion; tiger; lizard and MY_LOCATION draws from a newline list of places - then feeds the assembled prompt to CLIP. You can stack several Randomize nodes, one per placeholder, and get compound variety: an animal, a place, a color, a time of day, all independent. Combined with the "bracket trick" intuition, this is the fastest way to explore a character or scene family without changing your base prompt. It also pairs with the pack's Replace node for turning delimiters into clean formatting afterwards.
Install
Ships in EBU PromptHelper. ComfyUI Manager: search "EBU PromptHelper", or:
cd ComfyUI/custom_nodes
git clone https://github.com/burnsbert/ComfyUI-EBU-PromptHelper
then restart ComfyUI. No models, no extra pip packages - pure Python stdlib.
Troubleshooting
The two classic miss-the-point moments: forgetting to match word_to_replace exactly (the replacement is exact-substring and case-sensitive by default, so my_animal won't hit MY_ANIMAL), and leaving a stray space in the options list (" dog" vs "dog") - the splitter strips whitespace, so that one usually sorts itself out. And if word_selected ever comes back with a number in it, you left the N>> prefix on the option; it's stripped before replacement, so check you're reading word_selected, not the prompt, which is correctly clean.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt_text | STRING | — | |
| word_to_replace | STRING | — | |
| replacement_options | STRING | — | |
| seed | INT | 00–18446744073709550000 | — |
| case_sensitive | BOOLEAN | true | — |
| delimit_options_with | COMBO | newlines | 3 options: newlines, commas, semi-colons |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| updated_prompt_text | STRING | — |
| word_selected | STRING | — |