Nodes/ComfyUI-LoadRandomText/Random Text (Classic)
ComfyUI Node

Random Text (Classic)

Pure variety every run

By thezveroboy·Created 9 months ago·Updated 9 months ago· 1
Random Text (Classic)
    • text
    • text_path
    • debug
    folder
    include_subfoldersfalse
    extensions.txt,.prompt,.md
    encodingutf-8
    errorsreplace
    debug_infofalse

    Sometimes you don't want reproducibility. You want a new prompt every single run, full stop. Random Text (Classic) is the stripped-down member of this pack: point it at a folder and every time the graph runs it grabs a random file and hands you the contents as a string. No seed input, no memory, no "avoid repeats" logic - just random.choice() over whatever's in the folder.

    It's the simplest node in the pack, and it's the author's answer to a specific gripe: most wildcard implementations have lousy variance, and pure {a|b|c}-style substitution (the old A1111 syntax that still runs through packs like Impact Pack) tends to re-roll the same handful of options. Classic doesn't try to fix that distribution - it just makes "pick a file" as raw as it gets. One run, one file, next run, a different one, no promises about which.

    How it works

    Two lines do the heavy lifting. The node collects every file in folder matching the comma-separated extensions (default .txt,.prompt,.md), then random.choice() picks one. The part worth understanding is ComfyUI caching: this node's change signature returns a random value on every call, which tells ComfyUI "this output is always new, don't serve me a cached result." That's what forces a fresh pick on every execution. It's deliberate, not a bug - without it, ComfyUI would happily hand you the same file until you nudged a widget.

    Inputs and outputs

    There's exactly one required input:

    • folder - absolute path to your prompt library.

    Everything else is optional: include_subfolders, extensions (add your own, comma-separated), encoding (utf-8), errors (replace), and debug_info. Outputs are the same trio as the rest of the pack:

    • text - the file's contents as a STRING; wire it into CLIP Text Encode.
    • text_path - full path of the picked file.
    • debug - empty unless debug_info is on.

    Install

    Manager search "LoadRandomText", install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/thezveroboy/ComfyUI-LoadRandomText
    

    Restart and you're done. No dependencies beyond the Python standard library, no model downloads, nothing heavy.

    Common issues

    • "Folder ... cannot be found" - relative path or a typo. Use the absolute path.
    • "No valid text files found" - your file extensions aren't in the list. Add .txt,.prompt,.md,.cfg or whatever you actually use.
    • The real gotcha: you can't go back. Fall in love with a result and there's no seed to recover the file from. If you were smart enough to wire text_path into a display node before you ran it, the answer is saved in the workflow; otherwise it's gone. If you think you might want to reproduce a run, swap this node for the Seed variant - it's the same pack, and it's a two-second change.

    Classic is the node to grab when you're exploring or batch-generating for a cherry-pick and you want maximum spread. Just know what you're signing up for: pure surprise, zero receipts.

    Categoryzveroboy/random

    Inputs (6)

    NameTypeDefaultDescription
    folderSTRING
    include_subfoldersoptBOOLEANfalse
    extensionsoptSTRING.txt,.prompt,.md
    encodingoptSTRINGutf-8
    errorsoptSTRINGreplace
    debug_infooptBOOLEANfalse

    Outputs (3)

    NameTypeDescription
    textSTRING
    text_pathSTRING
    debugSTRING