Nodes/ComfyUI-LogicUtils/Random Shuffle String
ComfyUI Node

Random Shuffle String

Shuffle a delimited list of strings, seeded

By aria1th·Created 3 years ago·Updated 7 months ago· 116
Random Shuffle String
    • STRING
    input_stringa$b$c
    separator$
    seed0

    Random Shuffle String takes a delimited string - a$b$c by default - and hands back the same items in a randomized order, re-joined with the same separator. It's a shuffle, not a pick: nothing is dropped or duplicated, the set of items coming out is identical to what went in, just reordered.

    It ships in aria1th's ComfyUI-LogicUtils, a personal utility pack from the trainer behind Illustrious XL - a collection of math, string, and logic helpers that's genuinely obscure online but does exactly what its node names say. This one is marked is_output_node: true in the schema, meaning ComfyUI treats it as a terminal point in the graph in its own right (you'll see its result surfaced directly), not just an intermediate value passed silently downstream.

    Why you'd want this

    Order can matter even when the underlying content doesn't - a fixed sequence of prompt fragments, camera angle keywords, or style tags can bias a model toward whatever comes first or last, depending on the model's tokenization quirks. Shuffling breaks that positional bias between runs while keeping the same pool of items. Because it's seeded, you can still reproduce a specific shuffle exactly by reusing the same seed, which plain Python random.shuffle() in an ad-hoc script won't give you without you managing the seed yourself.

    How it works

    It splits input_string on separator, shuffles the resulting list using seed to drive the random state, and rejoins the shuffled list with the same separator into a single output string.

    Inputs and outputs

    • input_string (STRING, default a$b$c) - the items to shuffle, as one delimited string.
    • separator (STRING, default $) - the delimiter to split and rejoin on.
    • seed (INT, default 0) - controls the shuffle. Same seed, same input → same shuffled order, every time.
    • Output: STRING - the shuffled items, rejoined with separator.

    How to install it

    ComfyUI Manager: search "ComfyUI-LogicUtils", install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/aria1th/ComfyUI-LogicUtils
    

    then restart. No models or heavy dependencies - a CPU-only string operation.

    Common issues & troubleshooting

    "Missing node type" on a shared workflow. ComfyUI Manager's "Install Missing Custom Nodes" installs the whole pack from the graph JSON in one step.

    Import error on startup. The README documents an opt-in dependency auto-installer: set COMFYUI_LOGICUTILS_AUTO_INSTALL=1 before launch if a node needs something not already installed, or COMFYUI_LOGICUTILS_SKIP_INSTALL=1 to turn that hook off if it's the problem. RandomShuffleString itself needs nothing beyond the standard library.

    Same order every run when you expected variation. Check seed - if it's fixed and you didn't change it, you'll get the exact same shuffle every time, which is the point of a seed, not a bug. Randomize the seed (or wire it to something that changes per run) if you actually want a fresh order each time.

    Extra empty items appearing after shuffling. Usually a trailing separator in input_string (e.g. a$b$c$) producing an empty final item after the split - trim trailing separators from your source string if you don't want a blank entry mixed into the shuffle.

    CategoryLogic Gates

    Inputs (3)

    NameTypeDefaultDescription
    input_stringSTRINGa$b$c
    separatorSTRING$
    seedINT00–9223372036854776000

    Outputs (1)

    NameTypeDescription
    STRINGSTRING