Nodes/Eden.art nodesuite/Eden_RandomPromptFromFile
ComfyUI Node Runs on cloud

Eden_RandomPromptFromFile

A text file becomes a prompt roulette — one prompt per line, pick by seed

By edenartlab·Created 3 years ago·Updated 6 months ago· 119
Eden_RandomPromptFromFile
    • STRING
    file_pathprompts.txt
    seed0

    Eden_RandomPromptFromFile reads a text file - one prompt per line - and returns one of the lines as a string, chosen by seed. It's the simplest kind of wildcard system: no syntax, no placeholders, no processor. You write a file full of prompts, wire this into your prompt encoder, and every run gets a different starting point. For a lot of people that's all the variety they actually needed.

    How it works

    The mechanism is deliberately plain. It opens file_path, reads every line, strips whitespace, and drops empty lines. Then it selects the prompt at index seed % len(lines). That modulo selection is worth understanding, because it changes how the node behaves: it's not a random draw in the usual sense - it's a deterministic index into your list. Change the seed by one and you move to the next line, wrapping around when you hit the end. Same seed always picks the same prompt.

    Inputs

    • file_path (STRING, default prompts.txt) - the file to read. Relative paths resolve against ComfyUI's working directory.
    • seed (INT, default 0) - which line to pick.

    Output: a single STRING with the chosen prompt.

    Why you'd use it

    Batch variety is the headline. Curate a file of prompts - "a misty mountain at dawn," "a neon alley in the rain," "an astronaut on a desert planet" - and chain the seed to your sampler's seed so each image gets a fresh prompt that you can reproduce. It's also the honest replacement for a full wildcard engine when your needs are simple: you don't need bracket syntax and nested randomization if a list of good prompts does the job. Since it returns plain text, you can feed it into anything that takes a string - a CLIP Text Encode, an Eden_GPTPromptEnhancer as a starting point, or a text display to see what got picked.

    Installing it

    Part of the Eden.art nodesuite (edenartlab/eden_comfy_pipelines). Install via ComfyUI Manager (search "Eden.art nodesuite") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/edenartlab/eden_comfy_pipelines
    cd eden_comfy_pipelines && pip install -r requirements.txt
    

    Restart ComfyUI.

    Common issues

    The two that trip people up: path resolution and the modulo selection. A relative file_path resolves from wherever ComfyUI runs, which is frequently not where you think the file is - an absolute path kills the ambiguity. And because selection is seed % len(lines), you don't get uniform "random" coverage if your seed and line count interact badly; more importantly, a seed larger than your line count wraps around, so you'll see repeats long before you've seen all your prompts. If that bothers you, treat the seed as "page number into the list" and accept the wrap. Missing file → clean error, which is a nice change from the pack's silent error strings.

    CategoryEden 🌱/general

    Inputs (2)

    NameTypeDefaultDescription
    file_pathSTRINGprompts.txt
    seedINT00–18446744073709550000

    Outputs (1)

    NameTypeDescription
    STRINGSTRING