ComfyUI Node

Random List Selector

Roll the dice on your prompt styles

By DebugPadawan·Created about a year ago·Updated 5 months ago· 2
Random List Selector
  • input_list
  • selected_items
  • count
  • first_item
seed0
count1
allow_duplicatesfalse

You've got a list of styles - "cinematic", "watercolor", "anime", "photoreal" - and you want the workflow to grab one at random each run, but the same one next time for the same seed. Random List Selector is exactly that: pick random items from a list, reproducibly. It's the poor man's wildcard system, and for a lot of workflows it's all you need.

It ships in DebugPadawan's ComfyUI Essentials, a pure-Python utility pack. The selection logic is random.Random(seed).choice() / .sample() - nothing exotic, nothing requiring models.

How it works

Four required inputs:

  • input_list - the LIST to draw from
  • seed - the reproducibility key (INT, default 0)
  • count - how many items to pick (INT, default 1)
  • allow_duplicates - whether the same item can be picked more than once (BOOLEAN, default False)

Three outputs:

  • selected_items - the LIST of what got picked
  • count - how many were actually selected
  • first_item - a convenience output: the first selected item (or None if the list was empty), handy when you only want one

The behavior differences are worth knowing. With allow_duplicates on, it does count independent picks with replacement - you can get repeats. With it off (the default), it samples without replacement, and it silently caps the request: asking for 5 items from a 3-item list gives you 3. Empty input list? You get ([], 0, None) - no crash, just nothing.

Where you'll use it

  • Random prompt styles. Feed a list of style strings (build it with the pack's List Create or Text Splitter) and pipe first_item into a prompt or Text Joiner.
  • Random seeds, colors, tags. Any list of options you want to cycle through randomly but reproducibly.
  • Variation batches. Pick 3 styles from 10 and iterate a batch - seed controls everything, so the same seed reproduces the same picks.

Installing it

Whole pack, one install. ComfyUI Manager, searching for "DebugPadawans-ComfyUI-Essentials," or:

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

Then restart ComfyUI. Requirements (numpy, torch, opencv-python) are already present in stock ComfyUI; no model downloads. Search carefully: this is DebugPadawan's ComfyUI Essentials, not cubiq's "ComfyUI Essentials" (a different pack, now in maintenance mode).

Gotchas

  • allow_duplicates off silently caps the count. If you set count to 10 on a 5-item list, you get 5 back and the count output tells you so - but it won't error. If selections seem short, that's why.
  • first_item is type * (any). It's whatever was in the list - string, int, list. Wire it accordingly.
  • input_list must already be a LIST type; if you're getting a comma-separated STRING, split it first (Text Splitter in this pack).
  • Small pack, little community footprint - for a node this deterministic the source is the doc.
CategoryDebugPadawan/List

Inputs (4)

NameTypeDefaultDescription
input_listLIST
seedINT00–18446744073709550000
countINT1
allow_duplicatesBOOLEANfalse

Outputs (3)

NameTypeDescription
selected_itemsLIST
countINT
first_item*