Random Line
The Tiny Random-Prompt Node That Refuses to Repeat
- STRING
RandomLine is the smallest node in the pack and the least ambitious: one text box, one button, it picks a random line. Paste a list - thirty style names, twenty subjects, a set of lighting conditions - and every time the workflow runs, a different line comes out.
It earns its place by being the purest form of the idea: no seed, no index, no reproducibility, just entropy. The source deliberately builds its randomness from the system clock XOR'd with OS-level random bytes and the node's own id, so every run is genuinely different. That's a feature if what you want is surprise, and a liability if what you want is a batch you can compare fairly.
How it works
The text field is split on newlines and blank lines are filtered out. One line is chosen via a freshly-seeded random.Random instance. Then the node does something easy to miss: it appends a trailing comma to the selected line (unless it already ends with one). That's for tag-chaining - so solarpunk becomes solarpunk, and slots cleanly into a comma-separated prompt when merged with other parts.
Output is a single STRING.
Inputs and outputs
text- your multiline list. That's the only input.- Output:
STRING- the selected line, comma-terminated.
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. Standard-library Python only, nothing to pip install. It sits under the hexxacubic category in the node menu.
Where it fits - and where to avoid it
The honest take: use RandomLine when you're exploring and don't care about repeating results - moodboards, style roulette, "what does this checkpoint do with a random environment." Use one of the seeded siblings from this same pack (FiveRandomLines or Simple_Prompt_Library) when you need reproducible batches, because you will want to rerun a good roll and RandomLine can't give it back to you.
The trailing comma is also a trap in isolation. If you wire RandomLine straight into Double_Prompt_Encode on its own, you'll get a prompt ending in , - harmless but odd. The intended flow is RandomLine → Prompt_Extender, which merges the picked line with your base and strips the mess. That pairing - random slot plus fixed global - is where the node actually shines.
And if the output ever comes back empty, your text field is just blank lines. There's no error, no warning - the node quietly returns "". Check your list before you blame the sampler.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |