Nodes/Vantage-Nodes/Random String From List
ComfyUI Node

Random String From List

Pick a random line from your prompt list — seeded, so you can rerun it

By vantagewithai·Created 8 months ago·Updated about a month ago· 25
Random String From List
    • string
    • count
    text
    include_emptyfalse
    seed-1

    You've got a multiline list of prompts and you want a random one to feed into a text encoder. This node does exactly that - with the one thing that makes it actually useful: a seed. Random prompt selection is fine for one-off exploration, but when you find a great result you want to reproduce it, which means the pick needs to be deterministic given a seed. This node gives you both modes.

    Line-by-line prompt lists are a stock ComfyUI workflow pattern - a list of subjects, styles, or negative prompts where each run grabs one. What people typically cobble together with a random-integer node plus an indexer, this node does in one step, and it also hands you the count so you can see how big your list is.

    What it needs

    • text - the multiline list. One entry per line.
    • include_empty - whether blank lines count as candidates. Default false, which is what you want for pasted lists with stray blank lines.
    • seed - the one that matters. Default -1 means truly random every run. Set it to any non-negative integer and the pick becomes reproducible: same list, same seed, same line. This is the trick for rerunning a lucky pick or sharing a workflow with the exact selection locked in.

    Two outputs:

    • string - the chosen line.
    • count - how many lines were in the list (after empty-line filtering). Comes in handy if you're pairing this with an indexer and need to know your list length, or just to confirm your list parsed the way you think.

    If the list ends up empty, you get an empty string and count 0 rather than an error - remember that if downstream suddenly sees an empty prompt.

    How to think about the seed

    -1 is "chaos mode," anything else is "same list, same seed, same answer." If you're doing A/B comparison of sampling parameters, lock the seed so only the sampler changes. If you want variety across a batch, drive the seed from an integer node per iteration instead of leaving it at -1, so each pick is random but still recoverable from your logs.

    Install

    Part of Vantage-Nodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/vantagewithai/Vantage-Nodes.git
    pip install -r requirements.txt
    

    or ComfyUI Manager → search "Vantage-Nodes" → Install → restart.

    Common issues

    • Same prompt every run - you've set a fixed seed. That's reproducible-by-design; change the seed or drop it to -1.
    • Blank result - your list was all empty lines, or include_empty filtered everything out. Check the count output.
    • Picking from a comma list instead of lines - this node splits on newlines. If your list is comma-separated, run it through the pack's DelimiterSplit first to get lines.
    CategoryVantage/String

    Inputs (3)

    NameTypeDefaultDescription
    textSTRING
    include_emptyBOOLEANfalse
    seedINT-1

    Outputs (2)

    NameTypeDescription
    stringSTRING
    countINT