shuffle
Shuffle a list with a seed you can trust
- list
- LIST
Randomize the order, but keep a re-run button
Shuffle is what you reach for when a workflow has gotten too deterministic. You have a fixed list of prompts, a fixed order of images, and you want variety - but you also want to be able to reproduce a particular arrangement. This node shuffles a LIST into a new random order using a seed, so the same seed gives the same shuffle and a new seed gives a new one.
It's the sibling of "pop random" in this pack, but where pop random removes an item, shuffle keeps every item and just scrambles the order. Great for randomizing the order of a batch of seeds, a queue of prompts, or any list where sequence matters but the items themselves don't.
How it works
Mechanically it's random.shuffle() on a copy of the list - your input is never mutated, and you get a fresh LIST out. The seed drives the shuffle. This is where one implementation detail deserves a knowing nod: the node reseeds Python's global random with your seed before shuffling. For a single shuffle that's harmless, but if you have other custom nodes in the same graph that draw on the global random without seeding themselves, this can quietly change their results. The pack's "pop random" node uses a private Random(seed) instance and avoids that; shuffle doesn't. It's a minor quirk, not a bug - just don't be surprised if unrelated random things shift around when you change this seed.
The seed input is required (default 0) and has no "control after generate" animation, so it behaves like a fixed value until you type a new one.
Inputs and outputs
- list (LIST) - the list to scramble.
- seed (INT, default
0) - reproducibility control. Same seed, same order.
Output is a single LIST: all the same items, new order.
Installing it
Part of Basic data handling by StableLlama, the r/StableDiffusion regular known for his deep model comparisons (the Flux Klein 9B writeup especially) rather than his code. This pack is featherweight by design: zero runtime dependencies in its pyproject, no model files, nothing GPU-bound.
Install via ComfyUI Manager (search "Basic data handling") or:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
Restart ComfyUI; find it under Basic/LIST.
Troubleshooting
If your "random" order doesn't change between runs, you're reusing the same seed - change it. If it changes when you didn't want it to, something else is feeding a new value in. And the subtle one: because this reseeds the global random, an identical shuffle can nudge other RNG-based nodes elsewhere in your graph. For strict isolation, prefer "pop random" or seed any other random nodes yourself. Also remember the input is the pack's LIST type, not a native ComfyUI data list.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| list | LIST | — | |
| seed | INT | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LIST | LIST | — |