Text randomizer with check
The text randomizer that checks your brackets before you run
- text
The same randomizer, with a linter bolted on
If you've used the pack's plain Text randomizer, you know the one failure mode it has: an unclosed [ doesn't error. The literal bracket just rides along into the text encoder and poisons your prompt, silently. This node is the fix. It does everything RandomizeText does - identical [a|b] randomization, same seed handling - and additionally shows you a live bracket-and-parenthesis check as you type, before you queue anything.
The check runs in the browser, not the backend, on every keystroke. A read-only info_text box turns green with "All brackets and parentheses are properly matched!" or red with the exact positions of whatever doesn't balance (positions are 1-indexed, like a linter pointing at a line). You can even use it as a standalone bracket checker: paste text in, don't connect it to anything, read the verdict. The README suggests this exact trick, and it's the node's best party piece.
How the check works - and where it's shallow
The mechanism is a simple stack scan of [/] and (/). That's it. The two character types are tracked separately, which is the whole caveat in the README: [ ( ] ) passes, because from the checker's point of view the brackets balance and so do the parentheses - it never verifies that they interleave correctly. It also doesn't understand {}, doesn't validate (word:1.3) weight syntax, and won't notice a stray comma-split option. It's a balance check, not a full prompt validator. Think of it as catching the most common self-inflicted wounds, not all of them.
Inputs and outputs
Three inputs, and two of them you'll already know:
- text (multiline) - your template, same
[option1|option2]syntax as the plain node. - seed (INT, 0 to 2^64-1, default 0) - makes the pick reproducible. And yes, the same trap applies: the default 0 is deterministic, so change the seed if you actually want variety.
- info_text (optional, read-only) - not something you type into. The extension writes the check result here; it's pinned to a fixed height and marked read-only by the pack's JavaScript.
The output is a single text (STRING), wired straight into your text encoder just like the plain version. There's zero reason to prefer the plain node over this one unless you find the checker box annoying; it's a strict superset in behavior.
Installing it
Same as its sibling - this is a dependency-free pack, so this is as easy as it gets. Via ComfyUI Manager, search comfyui-text-randomizer, or:
cd ComfyUI/custom_nodes
git clone https://github.com/nosiu/comfyui-text-randomizer
Then restart ComfyUI. No requirements.txt, no pip installs, no model downloads.
Common issues
- The check doesn't fire - it's a frontend extension, so it needs the node added after the pack loads. If you just installed, restart ComfyUI once; a stale graph can miss the
onkeyuphook. Also note the check runs on the node'stextwidget as you type - it won't validate text piped in from another node's output, because that never passes through the keyboard. - "It says it's fine but my prompt is still broken" - that's the separate-tracking limitation.
[ ( ] )-style interleaving slips through. When in doubt, keep nesting shallow. - Same output every run - seed 0 is deterministic. This is a feature for reproducibility and a trap for variety; feed the seed from a changing source.
It's from the same small, no-drama pack as the rest of the text utilities: no community ecosystem, no issue tracker to lean on, just a few hundred lines of honest code you can read in five minutes. For a beginner with a multi-bracket prompt, the live check is the friendlier of the two randomizers - take it over the plain one and you lose nothing.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| seed | INT | 00–18446744073709550000 | — |
| info_textopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |