Nodes/Comfy DV Nodes/Random Choice
ComfyUI Node

Random Choice

Pick one of many inputs at random — with a seed when you want it reproducible

By darth-veitcher·Created 2 years ago·Updated 27 days ago· 2
Random Choice
  • input1
  • choice
seed0

Random Choice is the node you reach for when you want a workflow to roll dice. Wire in any number of inputs - images, strings, conditioning, latent, whatever ComfyUI can carry over a socket - and it returns one of them at random. Feed a couple of prompts or a couple of source images into it and every run gets a different one. It's a tiny idea, but it's the cleanest way to add variety to a batch without building a Python node.

How it works

Under the hood it's exactly what it sounds like: it collects whatever's wired into its inputs, calls random.choice, and passes the winner through the choice output. The inputs are input1, input2, … (any type - ComfyUI's wildcard *), and unused slots vanish when you disconnect them, so the node stays tidy as you add and remove options.

The thing that makes it more than a toy is the seed input:

  • seed = 0 (default): randomizes every run. Different pick each time, which is what you want for "variety mode."
  • Any non-zero seed: locks the selection. Same inputs, same pick, every run - which is what you want for debugging, or for sharing a workflow where the randomness itself is part of the result.

That maps to the same seed discipline the whole community preaches (change one variable at a time, lock your seed, compare). When you're hunting down why a batch produced a weird image, set the seed, run it a few times, and you'll see whether the randomness is the culprit.

Where you'd use it

  • Prompt roulette - several prompts in, one out, into a single KSampler. Great for generating a contact sheet of ideas.
  • Reference image rotation - a handful of reference images, pick one per run for an IPAdapter or style pass.
  • A/B testing harnesses - randomize which input a downstream branch sees, with a fixed seed for reproducibility.

Install

Via ComfyUI Manager (search "comfydv"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/darth-veitcher/comfydv.git

Restart ComfyUI; the node lives under dv/utils. No model downloads, no dependencies beyond what installs automatically with the pack.

Gotchas

  • Wildcard sockets and dead ends. Because inputs accept any type, ComfyUI sometimes can't infer a type until you wire something real in - connect an actual input before you judge the socket.
  • Same-input executions are cached. The node is an output node and uses ComfyUI's change detection, so if the exact same values re-run, don't expect a fresh pick every queue run - that's true of most ComfyUI nodes and not a bug. If you want fresh randomness each run, that's what the default seed = 0 is for.
  • It picks a value, not a weighted one. All inputs are equal. If you want some options favored over others, duplicate the input you like - crude, but it works.
Categorydv/utils

Inputs (2)

NameTypeDefaultDescription
input1*
seedoptINT00–18446744073709550000

Outputs (1)

NameTypeDescription
choice*