Nodes/unwdef-nodes/Random Text From Multiline
ComfyUI Node

Random Text From Multiline

Roll a random prompt out of a list — no wildcard pack required

By unwdef·Created 2 years ago·Updated about a year ago· 6
Random Text From Multiline
    • STRING
    seed0
    lines_count1
    delimiter,
    text

    If you've ever stared at a folder full of prompts and wished ComfyUI would just pick one for you, Random Text From Multiline is the two-widget answer. You paste a list - one option per line - and it hands you one random line, or several. That's the whole job, and it does it with zero dependencies beyond ComfyUI itself.

    Why you'd reach for it

    That's more useful than it sounds. The most common reason to reach for it is prompt roulette: you're seed-farming a character or a style, you want the subject, pose, or location to vary between runs, so you dump the variants into the text box and let the node do the picking. It plays the same role as a wildcard system like Dynamic Prompts, but it's one node instead of a whole pack. The author literally built it for this - their Reddit history shows a 151-Pokémon batch workflow that randomly picked names from a list to generate each one, and the pack grew out of that.

    How it works

    How it works is pleasantly boring. The node splits your text on line breaks, samples a set of unique lines (no repeats), and joins them with your delimiter. If lines_count is bigger than your list, it silently caps to what's there. And it reseeds Python's random generator from your seed, so the same seed plus the same list equals the same pick every time.

    The inputs that matter

    The inputs that actually matter:

    • text - your list, one option per line. This is the thing you'll edit constantly.
    • lines_count - how many lines to pick (default 1). Pick 2 with the default ", " delimiter and you're building multi-part prompts on the fly.
    • delimiter - what goes between chosen lines, default ", ". Switch to a space if your options already carry commas.
    • seed - set it once you find a combination you like, to lock it in.

    The output and wiring it

    The single output is a plain STRING. Wire it into the positive prompt input of a CLIP Text Encode, or into a Show Text node (the pythongosssss custom-scripts one, which the README screenshot uses) if you just want to watch the wheel spin.

    Gotchas

    Two gotchas. First, the seed lives in the node, but it reseeds ComfyUI's shared random generator - drop two of these in a graph with the same seed and they'll mirror each other, and any other node that rolls its own randomness without a seed can get dragged along. Vary the seeds. Second, an empty text box returns an empty string, and ComfyUI will happily encode that as a blank prompt. If your output looks like a coin flip between "nonsense" and "nothing," check your list first.

    Installing

    Installing it is the easy part. Open ComfyUI Manager and search "unwdef" or "unwdef-nodes", or clone it straight in:

    cd ComfyUI/custom_nodes
    git clone https://github.com/unwdef/unwdef-nodes-comfyui.git
    

    Restart ComfyUI and you're done - no pip install, no requirements, no model downloads. If the node doesn't show up after a restart, it's almost always the classic "Manager cached the old list" situation: refresh and reinstall, or check the folder name under custom_nodes. Updates are a git pull inside that folder and another restart.

    Categoryunwdef/text

    Inputs (4)

    NameTypeDefaultDescription
    seedINT00–18446744073709550000
    lines_countINT11–18446744073709550000
    delimiterSTRING,
    textSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING