Random File Entry
Random files, without drowning in one folder
- Entry
Random File Entry is Random Entry, but for files: it takes a file list and picks one at random. The interesting part is the even_chance_depth option, which stops your random samples from being dominated by whichever folder has the most files in it.
Why you'd reach for it
You've got a directory tree of reference images or training data - a few folders with ten images each and one folder with eight hundred. Plain random-from-list will land in that big folder almost every time, which is fine for some uses and quietly terrible for others (training-data sampling, thumbnail picking, any "give me a fair spread" job). This node has a mode specifically for that fairness problem.
How it works
Seed handling is the same as Random Entry: -1 (default) means truly random each run, any other seed gives a reproducible pick. Two extra behaviors worth knowing:
- Files inside any directory named
_ignore(case-insensitive, any depth) are excluded from the pool entirely. - With even_chance_depth at
0, it's a uniform pick over all files - plainrandom.choice. - With any positive value, it walks the folder tree and at every level treats each direct file and each subfolder as equally likely options. A folder with 800 files and a folder with 2 files get the same odds of being the chosen subfolder, then it recurses down to the leaves with the same rule. That's the "even chance per folder, not per file" behavior.
So the depth value is really an on/off switch for the balanced mode - the fairness applies at every level regardless of the exact number.
The inputs that matter
- seed -
-1for non-deterministic, else reproducible. - file_list - a list of file paths, typically from TinyBee's Get File List.
- even_chance_depth -
0= uniform over all files; any positive value = folder-balanced selection.
One output:
- Entry - the chosen file path as a STRING. Empty string if the list came up empty.
Installing it
TinyBee pack: ComfyUI Manager → Install Custom Nodes → search "ComfyUI-TinyBee", install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/TinyBeeman/ComfyUI-TinyBee
Under 🐝TinyBee/Lists. Stdlib only.
Common issues
The _ignore rule catches people off guard - if files keep "mysteriously" never being picked, check whether they live under a folder with that name. And the even-chance mode needs real folder structure in the paths; if every path is flat (no directories), it degrades to plain random choice. Empty results usually mean your file list is empty or entirely _ignored - check Get File List's glob before blaming this node.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| seed | INT | -1-1–18446744073709550000 | — |
| file_list | STRING | — | |
| even_chance_depthopt | INT | -1-1–100 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Entry | STRING | — |