pop random
Grab a random item out of a list, reproducibly
- list
- list
- item
A random pick, without the chaos
Sometimes you want randomness in a workflow - pick a random prompt from a batch, random seed from a range, random reference image from a folder list - but you also want the same pick when you hit queue again. That's exactly what this node does: it removes one random element from a LIST and hands you both the picked item and the list that's left, with a seed input that makes the pick reproducible.
The closest relative is the pack's plain "pop" node, which takes an explicit index. This one says "I don't care which one, surprise me" - and then lets you lock the surprise down.
How it works
The node copies the list and pops a random index out of the copy, so the original LIST stays untouched (same non-destructive behavior as the pack's other list editors). The seed drives a private random.Random(seed) instance, which is a nice detail: it doesn't reseed Python's global random state, so it won't quietly change what other random-dependent nodes in your graph do. Same seed, same item picked. Change the seed, get a different pick.
There's also an IS_CHANGED hook: when the seed has a "control after generate" widget (it does - the field animates to a new random seed each queue like a KSampler's seed), the node re-runs and hands you a fresh random pick. That makes it feel alive in a workflow instead of frozen at whatever you first clicked.
Inputs and outputs
- list (LIST) - the list you're picking from.
- seed (INT, default
0) - optional, but you'll almost always set it.0with "control after generate" means "new random every run"; a fixed value means "same pick every run."
Outputs:
- list (LIST) - the input minus the picked item.
- item (*) - the random element, ready to wire downstream.
Empty list? You get None for the item and the empty list back. No crash.
Installing it
This is part of Basic data handling by StableLlama - the same author whose model comparison posts (Flux Klein 9B, RealVisXL) are a staple on r/StableDiffusion. The pack is deliberately boring in the best way: zero dependencies in its pyproject, no models, no API calls, nothing that can break your environment.
Install via ComfyUI Manager ("Basic data handling") or:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
Restart, and find it under Basic/LIST.
Troubleshooting
The two things people trip on: forgetting the seed widget animates on its own, so their "fixed" pick changes between runs (right-click the seed to pin it if that annoys you), and expecting this to accept a native ComfyUI data list - it won't, only the pack's LIST type. And if item ever comes out None, your input was empty. Check that before blaming the node.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| list | LIST | — | |
| seedopt | INT | 00–18446744073709550000 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| list | LIST | — |
| item | * | — |