ComfyUI Node

Random Preset

Roll the dice on a whole preset file instead of picking

By nkchocoai·Created 3 years ago·Updated about a year ago· 26
Random Preset
    • STRING
    filename
    choice_preset
    seed0

    Load Preset makes you choose. Random Preset chooses for you. Same underlying CSV/YML preset files, same idea of a snippet library - but instead of a dropdown you commit to, you point it at a file and it hands back a random entry, controlled by a seed you can lock or randomize per queue.

    How it works

    filename selects which preset file to draw from - the samples cover both CSV (sample/animagineXL.csv, sample/clothes.csv, sample/empty.csv) and YML (sample/eyes.yml, sample/face.yml) formats, matching what Load Preset reads. seed drives the random pick: the same seed against the same file gives you the same entry every time, which matters if you want a specific "random" result to be reproducible later. Wire it to a primitive INT node with control_after_generate set to randomize and you'll get a fresh pick every queue instead.

    choice_preset is a multiline text field, and the only sensible read of it alongside a filename-plus-seed random-pick node is that it narrows the pool - list the specific preset names within that file you want eligible, one per line, and leave it blank to let the node pick from the whole file. The README doesn't spell this out explicitly, so confirm the behavior on a small file before relying on it.

    Note the README groups this node with Random Preset (Advanced) under a shared Experimental label: "There may be some bugs as we have not been able to check the operation very well."

    Inputs and outputs that matter

    • filename - which preset file to draw from, enum dropdown.
    • choice_preset - multiline, likely a way to restrict the random pool to specific named presets.
    • seed - controls which entry gets picked; same seed, same result.

    Output is a single STRING - the randomly chosen preset's text.

    Installing it

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

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

    No models or dependencies beyond Python. Find it under the PromptUtilities category once ComfyUI restarts.

    Where it fits

    This is a batch-variety tool: hook a randomizing seed up to it and every run in a queue pulls a different clothing tag, expression, or negative-prompt postfix from your library, instead of you manually cycling the Load Preset dropdown between runs. Useful for dataset-style generation or just seeing more of what your preset library can produce without babysitting it.

    Where people get burned

    Take the Experimental label seriously - this and its Advanced sibling are the two nodes in the pack the author explicitly hasn't fully verified. Same restart trap as Load Preset applies if you add your own files: new entries in presets/ won't appear until ComfyUI restarts, since dropdown-style choices are read at startup. And if choice_preset doesn't behave the way you expect (empty pool, unexpected picks), that's the field to double-check first - it's the one part of this node's schema the README is genuinely silent on.

    CategoryPromptUtilities

    Inputs (3)

    NameTypeDefaultDescription
    filenameCOMBO5 options: sample/animagineXL.csv, sample/clothes.csv, sample/empty.csv, sample/eyes.yml, sample/face.yml
    choice_presetSTRING
    seedINT00–18446744073709550000

    Outputs (1)

    NameTypeDescription
    STRINGSTRING