Nodes/was-node-suite-comfyui/Text Random Line
ComfyUI Node Runs on cloud

Text Random Line

Pick a random line of text each run

By WASasquatch·Created 3 years ago·Updated about a year ago· 1,812
Text Random Line

      Text Random Line is a small node with an obvious job and a lot of uses: give it a block of text, it hands back one random line. The README says it straight - "select a random line from a text input string." Where it gets fun is what you do with that.

      Why it's handy

      This is the cheap, no-dependency way to add controlled variety to a batch. Write ten subjects, one per line, and every run picks one. Write a list of lighting setups, or camera angles, or outfit descriptions, or artist styles, and let the workflow shuffle through them. It's the poor man's wildcard - no __file__ syntax, no dynamic-prompt extension, just a text box and this node. Pair it with WAS's own Text Multiline node (paste your list there) or Load Text File (keep your lists on disk), and you've got a prompt that reinvents itself each generation.

      Our prompt-engineering notes lean on this pattern: the durable way to explore a space isn't one clever prompt, it's a bank of options you sample from. Text Random Line is the sampler.

      How it works

      Two things matter: the text input (your lines, separated by newlines) and the seed. The seed is what makes the randomness reproducible - same seed, same line, every time. That's the whole reason it takes a seed instead of just calling random(): if a run comes out great, you can lock the seed and get that exact line back. Wire the seed to a control that changes each run (or a Number Counter) and you march through fresh picks; freeze it and you pin the choice. The output is a single line of text (a STRING) that you feed into your CLIP Text Encode or concatenate into a larger prompt.

      Things to watch

      • Blank lines count. An empty line in your text block is a line the node can pick, so you'll occasionally get nothing. Trim trailing newlines.
      • It's per-line, not per-word. If you want random phrases mixed into a sentence, that's a different node (Text Find and Replace by Dictionary handles keyed random substitution); this one swaps the whole line.
      • Reproducibility depends on the seed behaving. If you're chasing a specific result, make sure the seed feeding this node is the one you think it is.

      Installing it

      Ships in WAS Node Suite. Install the pack via ComfyUI Manager (search was-node-suite-comfyui, install, restart) or clone it:

      cd ComfyUI/custom_nodes
      git clone https://github.com/WASasquatch/was-node-suite-comfyui
      

      install requirements.txt, restart. No models needed - it's text handling.

      Troubleshooting

      Nothing about this node is fragile, but the pack around it can be. WAS Node Suite has been unmaintained since December 2023, and the common failure is the whole suite reporting "Import Failed" after a ComfyUI update - a dependency-version clash (opencv is the usual one, since WAS pins it). Reinstall requirements.txt into the correct venv (activate it first, or run install.bat). Once the suite loads, Text Random Line is about as reliable as a node gets.

      Categoryx

      Inputs (0)

      No inputs

      Outputs (0)

      No outputs