Dynamic Routes
The node that shuffles your wiring every time you hit Queue
- output0
The repo it ships in is literally called comfyui-ramdom-node - random, misspelled - and the typo is the honest part. Dynamic Routes does one thing: every time you press Queue, it randomly re-pairs the nodes feeding into it with the nodes it feeds out to. No settings, no models, no API. You wire a handful of things in, a handful of things out, and each run picks a fresh combination for you.
That's genuinely useful. You've got two prompts you keep flip-flopping between, or two samplers, or two checkpoints, and you want the variety without re-wiring by hand or babysitting a muter. Dynamic Routes is the "surprise me" button for a specific slice of your graph. It lives under Add node > utils > Dynamic Routes.
How it actually works
Here's the part that makes it weird: the Python side does nothing. DynamicRoutes is a virtual node - it has no FUNCTION method, nothing executes on the server, and ComfyUI marks it isVirtualNode. The Python class is just a passthrough carrying the AnyType trick (borrowed from Inspire Pack, which the README credits) so that any wire - checkpoint, latent, conditioning, whatever - is allowed to connect.
The whole feature lives in the browser JavaScript. On every promptQueued event it walks the graph, collects every node feeding in and every node being fed, disconnects the lot, Fisher-Yates shuffles the destination list, and reconnects. Two details worth knowing:
- It's a permutation, not independent sampling. With two sources and two targets you always get one each - never both sources dumped onto the same target. Which one pairs with which is random, but every downstream node still runs every time.
- The sources keep their positions; only the destinations get shuffled. If that ever matters, that's the direction it works.
The node also stays tidy while you work: as you plug wires in, it rebuilds its own slots to match the connected type and color-codes the links so the graph stays readable instead of becoming a spaghetti tangle.
Inputs and outputs
The schema is almost laughably thin, because everything is dynamic. You get a single *-typed input (unnamed in the schema) and one output0 of type * - "anything in, anything out." At runtime the frontend expands that into however many inputs you actually connect, adds a trailing catch-all slot so new wires always find a home, and mirrors the connected type onto the outputs. There is nothing to configure, no widget to fiddle with. If you're looking for a lever, this node is the wrong tool.
When you'd reach for it - and when you wouldn't
Reach for it when you want randomness: variation batches, "roll a random combo" experiments, a loose informal A/B where either pairing is fine. If you instead need controlled switching - always route A to X, never B to X - this is the wrong node. That's rgthree's Context Switch or good old mute/bypass group territory, and the community has real opinions about any-typed routers like this one: a widely-discussed "Please Stop using the Anything Anywhere extension" post made the case that type-agnostic routing makes workflows impossible to debug. Dynamic Routes is a milder cousin of that, but the caveat applies. If you save the workflow, the pairing in the JSON is whatever the last shuffle left behind - the next Queue press re-rolls it anyway.
Install
One of the lightest installs in the ecosystem. Via ComfyUI Manager, search the pack title comfyui-dynamic-routes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/shinich39/comfyui-ramdom-node
Restart ComfyUI. There's no requirements.txt, no model downloads, no torch tricks - the Python side is a dozen lines and the dotenv dependency is only for the author's publish script, not for you. That's the whole install.
The honest caveats
This is a tiny, single-maintainer pack (by Icheol Shin, MIT licensed) with essentially zero community footprint - no discussion threads worth finding, a handful of commits. You're the QA team. Because it works by tearing down and rebuilding connections through LiteGraph's frontend hooks, it's exactly the kind of JS-heavy custom node that ComfyUI's Nodes 2.0 rewrite has been known to break across the ecosystem - if the node misbehaves after an update, fall back to the legacy canvas and it'll probably settle down. And the flip side of "random every queue" is that you can't force a result: if you need reproducibility, this node's the opposite of what you want. Used as a deliberate randomness faucet, though, it's a clean little tool.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output0 | * | — |