TagRandom
Roll the dice on your prompt, keep your seed
- tags
TagRandom is the dice-roller of the comfyui_tag_filter pack. Feed it one comma-separated list of tags, tell it how many you want back, and it returns a random subset of them - reproducible per seed, no API, no model files, nothing to download. The trick it unlocks is variety without workflow surgery: one workflow, one pool of outfit or prop tags, and every run picks a different handful. The name undersells it, honestly. This is how you get ten different images out of a single graph without ever touching the KSampler seed.
What it actually does
You give it a pool - the whole WD14 tagger output for a character sheet, or a hand-built list of clothes you want to cycle through - and it slices out count_min to count_max tags. Hook the tags output into a text concat node or straight into CLIPTextEncode and each generation gets a different subset from the same source.
Mechanically it's gloriously simple: it parses the tags, shuffles the list with its own random.Random(seed), then takes the first N where N is a random integer between count_min and count_max. Flip the min and max and it swaps them back for you, which is a friendlier touch than most nodes bother with. Because the shuffle is seeded, the same seed always yields the same pick - so you can hunt for a lucky roll the way you'd hunt for a lucky generation seed.
The inputs that matter
Four inputs, and only two will surprise you:
tags- your pool, comma-separated.count_min/count_max- the range of tags you want back. Both default to 1, so untouched you get exactly one tag.seed- the reproducibility lever. Bump it to change the roll.
The single output is tags, a STRING, which is what you'd expect for something designed to feed a prompt.
Where people get burned
Order matters more than it looks like it should. On Danbooru-style tag models, earlier tags get stronger attention - put 1girl first and the model leans on it. TagRandom shuffles the list before slicing, so your winning tags not only change, they change position. For props and accessories that's usually fine. If you shuffle identity or character tags into a random spot, the attention re-weighting can shift the image in ways you didn't ask for. Keep the load-bearing tags out of the pool.
The other trap is quietly empty output: count_max is inclusive and the range is the only bound. Request more tags than the pool holds and you just get the whole shuffled list back. Not a bug, just don't expect it to pad.
Install
It ships inside the single comfyui_tag_filter repo. Easiest path is ComfyUI Manager - search "comfyui_tag_filter" in the Custom Nodes Manager and install. By hand:
cd ComfyUI/custom_nodes
git clone https://github.com/sugarkwork/comfyui_tag_fillter
Then restart ComfyUI. This pack has an empty requirements.txt and zero Python dependencies - the only payload is the bundled tag-category JSON files. There's nothing to trip over, no torch version fight, no model download.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| tags | STRING | — | |
| count_min | INT | 1 | — |
| count_max | INT | 1 | — |
| seed | INT | 12340–9223372036854776000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| tags | STRING | — |