Shuffle Image Batch
Randomize the order of a batch, deterministically
- images
- IMAGE
There's no description on this one beyond the name, and honestly the name tells you everything: it takes an IMAGE batch and shuffles the order of the images inside it, seeded so the shuffle is reproducible. That's it. No mode, no strategy, no extra behavior hiding behind the two inputs - which makes this one of the simplest nodes in the whole pack, and there's not much point pretending otherwise.
Where it's actually useful
Order within a batch matters more often than people expect in ComfyUI. If you're building a contact sheet or a comparison grid from a batch, feeding a batch into something that only samples the first N images, or preparing a set of frames for anything downstream that treats position as meaningful (the first image in a batch often gets special treatment somewhere in a pipeline - a reference frame, a thumbnail, a "primary" selection), a batch that arrived in a predictable order can quietly bias what you end up looking at. This node breaks that up. It's also handy any time you just want variety - decorrelating a batch before a random subset gets picked further down the graph.
The inputs and outputs that matter
images- the batch to shuffle.seed(default 123) - controls the shuffle order. Same seed, same input batch, same resulting order every time - this is deterministic, not truly random, which is exactly what you want if you ever need to reproduce a specific shuffled arrangement.- Output:
IMAGE- the same batch, reordered.
How to install it
Standard KJNodes install: via ComfyUI Manager (search "KJNodes for ComfyUI"), or manually - cd ComfyUI/custom_nodes && git clone https://github.com/kijai/ComfyUI-KJNodes, pip install -r ComfyUI-KJNodes/requirements.txt, then restart. No extra dependencies for this one; it's a handful of lines of batch-index math.
Common issues & troubleshooting
"It's not shuffling." Check your batch size first - with a single image in the batch, there's nothing to reorder, and the output will look identical to the input every time regardless of the seed. This isn't a bug, it's just that shuffling one item has exactly one possible order.
The order looks "the same" across runs even though you expected randomness. That's the seed doing its job - this is deterministic shuffling, not fresh randomness on every execution. If you actually want a different order each time, change the seed (or randomize it upstream) rather than assuming the node will vary on its own.
Don't confuse this with a true random sample. Shuffling reorders every image in the batch; it doesn't drop or duplicate anything. If what you actually wanted was a random subset rather than a reordering, this node gets you halfway there - shuffle first, then take the first N from the result with whatever batch-slicing node you're already using.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| seed | INT | 1230–18446744073709550000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |