Nodes/ComfyUI-PromptUtilities/Random Preset (Advanced)
ComfyUI Node

Random Preset (Advanced)

Random prompt and random LoRA in one pull

By nkchocoai·Created 3 years ago·Updated about a year ago· 26
Random Preset (Advanced)
    • positive prompt
    • negative prompt
    • lora name
    • strength model
    • strength clip
    • lora stack
    filename
    choice_preset
    seed0

    This is Random Preset's sibling for the pack's richer JSON preset format - the same "roll the dice on a file" idea, but sourcing presets that carry a full recipe (prompt pair plus LoRA config) instead of plain text. Point it at a preset file, get back a randomly-selected positive prompt, negative prompt, and matching LoRA, all in one node.

    How it works

    filename picks the JSON preset file - samples include sample/animagineXL.json, sample/clothes.json, sample/empty.json, sample/loras.json - matching the same advanced_presets directory that Load Preset (Advanced) reads from. seed controls which entry within that file gets pulled, deterministically per seed. choice_preset, a multiline field, reads the same way it does on the non-advanced Random Preset: most likely a way to restrict the random draw to a named subset of entries rather than the whole file, though the README doesn't spell out the exact matching behavior.

    Like its sibling, the README groups this node under the pack's Experimental label - the author's own words: "there may be some bugs as we have not been able to check the operation very well."

    Inputs and outputs that matter

    • filename - which JSON preset file to draw from.
    • choice_preset - multiline, likely narrows the random pool to specific presets.
    • seed - which entry gets picked; deterministic per seed, randomize it for a fresh draw each queue.

    Outputs mirror Load Preset (Advanced): positive prompt and negative prompt strings, plus lora name, strength model, and strength clip (matching a stock LoraLoader's fields), and a lora stack (LORA_STACK) output for chaining through Efficiency Nodes-style pipelines.

    Installing it

    ComfyUI Manager → search ComfyUI-PromptUtilities → install → restart. Or:

    cd ComfyUI/custom_nodes && git clone https://github.com/nkchocoai/ComfyUI-PromptUtilities
    

    No models, no heavy dependencies - the whole pack is pure Python string/file handling. You'll find it under the PromptUtilities category.

    Where it fits

    The pitch is "surprise me with a look and its matching LoRA": randomize the seed and each generation in a batch gets a different prompt pair plus the LoRA that was authored to go with it, rather than a random prompt paired with whatever LoRA happens to still be loaded from your last run. That coupling - prompt and LoRA locked together as one preset - is the actual value over just randomizing a prompt on its own.

    Where people get burned

    Treat the Experimental tag as a real warning, not boilerplate - this is the one node in the pack combining the least-tested logic (random selection) with the most output surface (six values instead of one), which is exactly where a subtle bug would be easiest to miss. Verify the LoRA output actually matches the prompt pair it's supposed to be bundled with before trusting it in an unattended batch. And the same restart requirement applies to any custom JSON files you add under advanced_presets/ - new entries won't show up in the filename dropdown until ComfyUI is relaunched.

    CategoryPromptUtilities

    Inputs (3)

    NameTypeDefaultDescription
    filenameCOMBO4 options: sample/animagineXL.json, sample/clothes.json, sample/empty.json, sample/loras.json
    choice_presetSTRING
    seedINT00–18446744073709550000

    Outputs (6)

    NameTypeDescription
    positive promptSTRING
    negative promptSTRING
    lora name
    strength modelFLOAT
    strength clipFLOAT
    lora stackLORA_STACK