JDCN_AnyFileListRandom
Random files from a folder, batch-sized, seed-controlled
- PathList
- PathNames
- Total
JDCN_AnyFileListRandom is JDCN_AnyFileList with a dice roll: same folder scanning and filtering, but instead of returning every match, it returns a random batch of paths, controlled by a seed. If you've ever wanted to sample a handful of random images from a reference folder, or randomize which training/reference files a run picks, this is the node.
How it works
It shares AnyFileList's inputs - folder_path, filter_by, extension, deep_search - then adds the selection controls:
random_seed- the seed for the random pick. Same seed, same selection. Change it, get a different batch.seed_change-fixed,increment,decrement, orrandom. This tells you how the seed should behave across queue runs. One honest caveat: like theChangedropdown onJDCN_AnyFileSelector, this is largely a label - the node computes the selection from the current seed value, so the automatic incrementing depends on you driving the seed (via a counter or the random option upstream). Treat it as "how I intend to move the seed," not "the node will do it for me."batch_size- how many files to select per run.
Outputs: PathList (the random subset), PathNames, and Total. One quirk straight from the source: only PathList is actually the randomized subset - PathNames and Total reflect the full matched folder, not your random pick. So if you wire Total into a loop expecting the batch size, you'll get the whole count instead. Keep that in mind and grab the count from PathList's length instead.
When you'd reach for it
- Random reference images for img2img or IP-Adapter runs - a different mood every queue.
- Randomly sampling a subset of a large training/reference set without writing a script.
- Batch variation: set
batch_sizeto 3, run, and feed the selected paths intoJDCN_BatchImageLoadFromListfor a random trio.
Installing it
Part of ComfyUI-JDCN:
- ComfyUI Manager β Install Custom Node β search JDCN β install ComfyUI-JDCN β restart.
- Or:
cd ComfyUI/custom_nodes
git clone https://github.com/daxcay/ComfyUI-JDCN.git
cd ComfyUI-JDCN
pip install -r requirements.txt
Restart; it's under π΅ JDCN π΅. Only dependency is piexif, no models.
Common issues
Same path typos and folder-not-found behavior as AnyFileList (empty lists + a console message). The subtle one is the Total/PathNames mismatch above - if your workflow counts on those matching the random batch, verify against the actual PathList. And for reproducibility, commit to a seed; random in seed_change is fun for exploration and a nightmare for "but it worked yesterday."
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| folder_path | STRING | undefined | β |
| filter_by | COMBO | 7 options: *, images, audio, video, text, tensors, +1 | |
| extension | COMBO | 153 options: *, .latent, .ckpt, .pt, .bin, .pth, +147 | |
| random_seed | INT | 11β18446744073709550000 | β |
| seed_change | COMBO | 4 options: fixed, increment, decrement, random | |
| batch_size | INT | 11β9999 | β |
| deep_search | BOOLEAN | false | β |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| PathList | STRING | β |
| PathNames | STRING | β |
| Total | INT | β |