Nodes/comfy-ovum/_.shuffle
ComfyUI Node

_.shuffle

Randomize a list, Fisher-Yates style, without touching the original

By sfinktah·Created about a year ago·Updated 10 months ago· 7
_.shuffle
  • list_or_dict
  • LIST

_.shuffle takes a list and returns a randomly reordered copy. The README's description calls out the algorithm by name - a Fisher-Yates shuffle - which is the correct way to do this: every permutation is equally likely, unlike the naive "sort by random key" approach that biases results. The wrapper deep-copies your input first, so the original list is untouched. If you want randomness without side effects, that's the whole pitch.

Why would you shuffle inside a generative pipeline? Randomizing prompt lists so each run pulls a different order, shuffling a deck of seed candidates, mixing up training captions, or breaking any fixed ordering that's biasing your results. It's the "variety" node - when your workflow keeps landing on the same outputs because the order of your inputs never changes, a shuffle up front is the cheapest fix.

The same family caveat

Like every _. node in comfy-ovum, this wraps underscore3 (a Python port of Underscore.js bundled inside the repo) and carries the author's explicit warning: work in progress, not recommended for production workflows. For a shuffle that's mostly fine - the semantics are simple and the algorithm is sound - but remember randomness and ComfyUI's output caching don't always get along. If the shuffled order stays identical between runs, the node's output is being cached; force a re-execution to re-roll.

Inputs and output

  • list_or_dict (*) - the collection to shuffle. Named that because the wrapper generator calls any collection input by that label; lists work perfectly, dicts get their values shuffled.

Output is a LIST - the shuffled copy, same length as the input. If you're shuffling a dict and expected the keys to come along, they won't; you get the values.

Family power move: pass a _.CHAIN in as the primary input and _.shuffle keeps the chain alive, returning a chain for the next method to consume (unwrap with _.value). So _.chain → _.shuffle → _.first → _.value is a legit "random item" pipeline in graph form.

Install

# via ComfyUI Manager: search "comfy-ovum"
cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum
# restart ComfyUI

No model downloads; pure Python, deps (aiohttp, pillow, numpy, requests, etc.) handled by Manager, underscore3 bundled. Want a reproducible shuffle for testing? There's no seed input here - pick a fixed random seed elsewhere or accept the roll of the dice.

Categoryovum/underscore

Inputs (1)

NameTypeDefaultDescription
list_or_dictopt*Primary input object (expected collection). You can still pass any JSON-serializable value. Also accepts _.CHAIN to continue chaining.

Outputs (1)

NameTypeDescription
LISTLIST