Dynamic String
Seedable random prompt selection for batch variety
- selected_string
IsekaiDynamicString picks one random line from a multiline list, every time the graph runs. Feed it a list of subjects and it hands back one of them; run the batch again and it picks another. The twist that makes it actually usable: it's seeded. Same seed, same pick, every time. So you get real variety across a batch while keeping results reproducible - which is the entire game in ComfyUI, where the same workflow JSON needs to behave the same way twice.
How it works
The mechanism is one line of Python: random.seed(seed), then random.choice() over your non-empty lines. The node splits text_list on newlines, strips whitespace, throws away empty lines, and selects. The default input is a little example list (ducks, dogs, cats, whales) so you can test it before replacing it with real content.
The seed input accepts a full 64-bit range (0 to 2^64−1), default 0. If you leave every seed at 0 in a batch workflow, you'll pick the same line every time - which is the classic mistake. To get variety across a batch, drive the seed from a changing value (batch iteration, or your main sampler's seed). Tie it to the sampler seed and every generation gets both a different seed and a different prompt line, deterministically.
The bigger pattern: wire this into IsekaiConcatenateString with a fixed style suffix. Subject varies, style doesn't. That's the standard "variation batch" workflow, and it needs nothing but these two nodes plus a text encoder.
The inputs
text_list- multiline string, one option per line. Required.seed- 0 to 2^64−1, default 0.
Output is selected_string, a single STRING - the chosen line.
Installing it
Ships in isekai-comfy-node:
ComfyUI Manager: search "isekai" → install isekai-comfy-node → restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/isekai-sh/isekai-comfy-node
cd isekai-comfy-node
pip install -r requirements.txt
Restart and it's under Isekai → Dataset. Pure Python, no image processing - it barely needs any dependency at all.
Common issues
The gotchas are all in how you use it, not how it works. Blank lines are skipped, but a trailing newline isn't an error - it's just filtered. If your list has fewer entries than you expect, check you didn't leave an empty line counting as a slot. And note the selection is uniform random: with a small list, getting the same pick twice in a row isn't a bug, it's probability. If you want guaranteed rotation through every option (no repeats until the cycle completes), this node isn't it - that's round-robin behavior, and it lives in the same pack as a separate node (Round Robin). Reach for the right tool.
Also: if you're switching from a wildcard-style workflow, this node doesn't parse {...} syntax - it's plain lines. Keep the list clean and the node will too.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| text_list | STRING | ducks dogs cats whales | — |
| seed | INT | 00–18446744073709550000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| selected_string | STRING | — |