ComfyUI Node

List Shuffler

Deterministic shuffle — same seed, same order, every time

By DebugPadawan·Created about a year ago·Updated 5 months ago· 2
List Shuffler
  • input_list
  • shuffled_list
  • count
seed0

Randomness you can reproduce is one of the most useful things ComfyUI gives you, and List Shuffler applies that idea to list order. Feed it a list and a seed, and it scrambles the items - but the same seed plus the same list gives you the same scramble, every single run. That's the difference between "random" that you can debug and "random" that's just chaos.

It's part of DebugPadawan's ComfyUI Essentials, a small MIT-licensed utility pack with a full family of list nodes.

How it works

The node makes a copy of the list and runs Python's random.Random(seed).shuffle() on it. Two details fall out of that:

  • The input list is not mutated. The shuffle happens on a copy, so the original list stays intact if you're also using it elsewhere.
  • The randomness is seeded, not true random. Seed 123 on ["a","b","c","d"] produces one specific order, and it'll produce the same order next time. Change the seed, get a different order. That reproducibility is the whole point - it's what lets you fix a "random" ordering while you debug the rest of the workflow.

Inputs and outputs

  • input_list - the LIST to shuffle.
  • seed - the reproducibility knob, default 0, range up to 2⁶⁴−1.

Outputs: shuffled_list (LIST) and count (INT - just confirming the length didn't change).

Install

Standard custom-node fare:

cd ComfyUI/custom_nodes
git clone https://github.com/DebugPadawan/DebugPadawans-ComfyUI-Essentials.git

Restart ComfyUI, or install via ComfyUI Manager by searching "DebugPadawan". requirements.txt lists numpy, torch, and opencv-python - numpy and torch already ship with ComfyUI and the shipped code never imports cv2, so no heavy downloads, no model files, no API keys.

Where it earns its keep

  • Randomizing processing order - shuffle a batch's frames or prompts so the same pipeline produces variety run to run, then lock the seed when you find a good run.
  • Reproducible A/B ordering - shuffle a list of two prompt variants with a fixed seed, and every run alternates the same way; flip the seed to flip the order.
  • Tag/prompt randomization - shuffle a tag list before it goes into a prompt builder for variety you can still reproduce.

One honest caveat: an empty list gives you an empty list and count 0 - no crash, but also nothing to shuffle. Check the count output if your shuffle ever seems to do nothing.

CategoryDebugPadawan/List

Inputs (2)

NameTypeDefaultDescription
input_listLIST
seedINT00–18446744073709550000

Outputs (2)

NameTypeDescription
shuffled_listLIST
countINT