Nodes/ComfyUI_StringOps/随机行内容🐠meeeyo.com
ComfyUI Node

随机行内容🐠meeeyo.com

The wildcard-style random prompt picker, without the wildcard plugin

By MeeeyoAI·Created 2 years ago·Updated about a year ago· 209
随机行内容🐠meeeyo.com
  • any
  • STRING
input_text

RandomLineFromText is the simplest way to get "pick a random prompt from a list, every run" into a ComfyUI graph: you paste a list of lines into a text box, and it hands back one of them, chosen at random, as a STRING. That's the whole node - one multiline input, one string output.

If you've seen A1111 wildcards, you know the pattern: a bank of prompt variations, one drawn at random per generation. That's exactly what this is, minus the __promptbank__ folder and the plugin - the list just lives in the node's input field, and it's a full prompt per line rather than a token to substitute.

The inputs

  • input_text - multiline, one option per line. Each line is a candidate. Put "a cat in a studio", "a dog in a park", "a fox in the snow" on three lines and each run picks one at random.
  • An optional wildcard any input that accepts anything and does nothing - the author's standard trick in this pack for nudging execution order in the graph.

The behavior that matters

Like most nodes in this pack, it marks itself always-changed, so it re-rolls on every queue execution - even between frames in a batch, if that's how your graph runs. That's usually the point, but it also means there's no seed control: you can't reproduce a specific run's pick, and you can't make it stable while you tweak other things. For reproducible work you'd be better served by a deterministic index-based selector (ExtractSpecificLines in the same pack will do the job if you supply the index).

Two practical notes. First, blank lines and leading/trailing whitespace are stripped before the pick, so tidy formatting won't accidentally become a candidate. Second, each line is picked whole - if you want two random parts combined, chain two of these and feed both into a text concatenation, rather than trying to pack combinatorics into one line list.

Where it shines

This is a workhorse for variation batches. Line one = "masterpiece, best quality, a cat", line two = the dog version, line three = the fox - run a batch of N and you get an even-ish spread of the three subjects without building any fancy switching logic. Wire the output into a CLIP Text Encode (or into ProcessString first if some of your lines need cleanup), and it just works.

Installing

Same install as the rest of MeeeyoAI/ComfyUI_StringOps:

cd ComfyUI/custom_nodes
git clone https://github.com/MeeeyoAI/ComfyUI_StringOps.git

or via ComfyUI Manager searching ComfyUI_StringOps, then restart. No models, no dependencies beyond what ComfyUI already ships. It lives under "Meeeyo/String".

It's a one-liner of a node, but the "random prompt per run" pattern is so common that having it as a built-in is worth more than its tiny footprint suggests. Just don't expect reproducibility - randomness here is the product, not a bug.

CategoryMeeeyo/String

Inputs (2)

NameTypeDefaultDescription
input_textSTRING
anyopt*

Outputs (1)

NameTypeDescription
STRINGSTRING