Five Random Lines
Building Varied Prompts from Five Pools
- double_prompt
FiveRandomLines is the batch-variation workhorse of this pack. You feed it five separate pools of prompt lines - a pool of styles, a pool of subjects, a pool of lighting, whatever - plus one static "global" prompt, and it rolls one line out of each pool and stitches them into a single prompt. Run it five times, get five genuinely different compositions instead of five re-rolls of the same sentence.
The mental model is simple: one field per slot, one line picked per field. Keep your pools thematically separate and the combinations stay coherent. It's the kind of node you set up once for a character-expression or concept-exploration batch and then forget about.
How it works
Each of the five text fields is split on newlines; one line is selected from each. The selection is seed-driven - the node reseeds Python's random generator with seed + field_index per field, so all five picks are independent but reproducible from a single seed. The global_prompt field is not random: it's your constant base, the part that must be there every time.
Every selected line can itself carry the pack's --- convention to split positive/negative. The positives from all picked lines are merged into one positive side, the negatives into one negative side, and the whole thing is emitted as a double-prompt string. prepend_mode decides whether the global prompt leads (true) or trails (false) the random parts.
The combine step is thoughtful: it inserts a comma between parts only when one isn't already there, so you don't end up with masterpiece,, detailed.
The inputs that matter
global_prompt- your static base, e.g.masterpiece, best quality --- blurry, low quality.text_1…text_5- five pools, one line per variant. Any field you leave blank is simply skipped.prepend_mode- put the global prompt first (default) or last.seed- controls which line each pool picks. Fix it to reproduce a batch; change it to explore.
Outputs
double_prompt- a STRING in thepositive\n---\nnegativeformat. Wire it intoDouble_Prompt_Encodeto get conditioning, or into a text viewer to eyeball it.
How to install it
Install the pack via ComfyUI Manager (search ComfyUI-Prompt_Library) or:
cd ComfyUI/custom_nodes
git clone https://github.com/hexxacubic/ComfyUI-Prompt_Library
Restart ComfyUI. No pip step, no model downloads - it's pure standard library. It shows up under the hexxacubic category.
Where people get burned
Two things trip people up. First, empty fields are silently skipped - if you expect five lines in the output and you're getting four, one of your text boxes is blank or full of blank lines. Second, the seed is doing all the reproducibility work: if you leave it moving or use it to drive other nodes, the troubleshooting rule from the community applies hard here - fix the seed while you're debugging, then unfreeze it when you actually want variation. The node even resets the random state when it's done so it doesn't contaminate other nodes, which is the kind of hygiene you learn to appreciate.
One trap worth naming: this node does not randomize the global prompt, ever. People sometimes assume all six fields roll. If you want the constant-to-variable balance shifted, that's what prepend_mode is for - flip it and the random parts lead, which changes how the model weights the sentence. Earlier tokens get more attention on SDXL-lineage models, so where you put the "always include" text genuinely matters.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| global_prompt | STRING | — | |
| text_1 | STRING | — | |
| text_2 | STRING | — | |
| text_3 | STRING | — | |
| text_4 | STRING | — | |
| text_5 | STRING | — | |
| prepend_mode | BOOLEAN | false | — |
| seed | INT | 00–18446744073709550000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| double_prompt | STRING | — |