๐ผ> Text Pick Random Line
A node-based wildcard, no extension required
- text
Put a list of alternatives in a multiline text box, one per line, and this node picks one at random each run. It's functionally the same idea as the old A1111 {option one|option two|option three} bracket syntax people use for prompt variety - pick one thing from a set of alternatives - except expressed as a dedicated node with an actual list instead of inline curly-brace syntax buried in a prompt string. If you never learned the bracket trick (it's old A1111 wildcard syntax a lot of people who arrived post-2024 never picked up), this is arguably the more discoverable way to get the same effect in ComfyUI.
Obvious uses: a list of lighting styles, camera angles, or outfit descriptions, one per line, picked randomly per generation to add variety across a batch without you manually swapping text between runs.
How it works
The text input is split into lines; the node picks one at random, seeded by seed. Set seed to a fixed number and control-mode it to "fixed" in the UI and you'll get the same line every time - useful for locking in a specific pick you liked while iterating on the rest of the workflow. Leave it randomizing and you get a different line each run.
The inputs and outputs that matter
text- the multiline list of alternatives, one option per line.seed(default0) - drives which line gets picked. Set the seed control widget to "randomize" for a different line every run, or "fixed" to lock in one specific pick.
One output: text - the selected line, ready to feed into a CLIP Text Encode or combine with the rest of your prompt via Text Combine.
How to install it
Via ComfyUI Manager: search "yanc" or "YANC - Yet Another Node Collection," install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ALatentPlace/ComfyUI_yanc
then restart. No extra dependencies, no downloads.
Common issues & troubleshooting
Same line every time even though you wanted variety. Check the seed widget's control mode in the ComfyUI UI - right-click the node (or use the small control below the seed field) to set it to "randomize" rather than "fixed." A fixed seed will deterministically pick the same line on every run by design.
You wanted a fixed pick and it keeps changing. Same control, opposite direction - set it to "fixed" once you've landed on a line you want to keep, otherwise every queue re-rolls it.
Only one line ever gets picked no matter the seed. If your text box only has one line in it (or the rest are blank), there's nothing to pick between - check the source text actually has multiple non-empty lines.
You need weighted randomness - some lines more likely than others. This node treats every line as equally likely; there's no weighting parameter. If you need certain options to come up more often, the workaround is just repeating that line multiple times in the list so it has more chances to be picked.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | โ | |
| seed | INT | 00โ18446744073709550000 | โ |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | โ |