Nodes/ComfyUI-Tlant-Toolkit/Random Lines (Tlant)
ComfyUI Node

Random Lines (Tlant)

Plug in a wire, get a new output

By Tlant·Created 3 months ago·Updated 28 days ago· 0
Random Lines (Tlant)
    • line 1
    text
    是否重复false

    Random Line's big sibling, and it's the one with the party trick. Random Lines (Tlant) starts with a single line 1 output - then, the moment you connect that output, a second line 2 output appears. Connect that one and a third shows up. The node literally grows outputs to match how many you're using, driven by a small JS extension that ships inside the pack.

    It exists for the same jobs as its single-line cousin - sampling from a list of prompts, captions, negative prompts, wildcard pools - but for the moments when one random pick isn't enough: you want N different prompts feeding N branches, or a random subset from a bigger list in one shot.

    Mechanically it's simple and a little clever. Behind the scenes the node inspects your current workflow (via ComfyUI's hidden prompt / unique_id inputs), counts how many output sockets are actually wired up, and fills exactly that many. The one input that shapes the behavior beyond the text itself:

    • 是否重复 - the "allow repeats" switch. It defaults to (off), which means each output gets a distinct line position - you never see the same line twice. Flip it to and repeats are allowed, each slot drawn independently.

    That distinction matters because it changes the failure mode. In the no-repeats mode the node samples without replacement, so if you request more outputs than the input has non-empty lines it raises a clear error - connect three wires to a two-line list and the queue fails on purpose rather than silently duplicating. In the repeats-allowed mode you can ask for as many as you like.

    Everything else you'll want to know:

    • text - the multiline source, a forceInput socket. Blank lines are ignored.
    • Outputs - dynamic line 1, line 2, … each a STRING. Wire them into wherever prompts go.
    • Like the single-line node, it always re-executes (IS_CHANGED returns NaN), so every queue run gives you fresh picks - and, as with its sibling, that dirties the downstream branch. Loop it upstream of something expensive and you're paying full regeneration each iteration.

    Install

    ComfyUI Manager → search ComfyUI-Tlant-Toolkit → install, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Tlant/ComfyUI-Tlant-Toolkit
    

    Restart ComfyUI. No dependencies, no model downloads - but the dynamic-output behavior does need the frontend JS, which the install includes automatically. Don't try to replicate the output-growth by hand; just make sure you restarted after installing so the extension loads.

    Where people get burned

    The most common stumble is expecting repeats off to silently duplicate lines when your list is short. It doesn't - it errors, and the message tells you exactly how many outputs you asked for versus how many lines you actually have. Add a line to the source or switch 是否重复 to . The 是否重复 widget is labeled in Chinese (是/否), which trips up English speakers for exactly one second - 是 means "yes, repeats allowed."

    CategoryTlant Toolkit/Text

    Inputs (2)

    NameTypeDefaultDescription
    textSTRING
    是否重复BOOLEANfalse

    Outputs (1)

    NameTypeDescription
    line 1STRING