PromptRandomWeight
Weight) roulette — but check what encoder you're feeding first
- STRING
PromptRandomWeight is the pack's weighted-roulette node: it picks a few tags out of your prompt and wraps them in random attention weights, turning 1girl, long hair into something like 1girl, (long hair:0.7). It's a fine idea if you're on the CLIP-based anime SDXL line - Illustrious, NoobAI, Pony, that family - where (tag:1.3) syntax is real and earlier weights genuinely steer attention. It's the tool for "I want to vary emphasis without thinking about it."
How it works
Split on separator, pick max_weight_tags words, and wrap each in (word:weight) with the weight drawn uniformly between min_weight_value and max_weight_value, rounded to one decimal. The order menu decides which words get hit: Random samples tags that don't already contain a (, Ordered just takes the first N in place. It also clamps max_weight_tags down if it exceeds the number of words, so you can't ask for more weighted tags than exist.
The defaults are worth noticing: min_weight_value 0.0 and max_weight_value 1.0. That means the default range mostly dilutes tags (weights below 1.0 pull attention away) rather than emphasizing them. If you want occasional emphasis, set the range like 0.8–1.5 so the roulette can land above 1.0. And note the weight boundaries are ±5, which is plenty wide - a (tag:5.0) is a very loud tag.
Inputs and outputs
prompt- STRING.separator- STRING, default,.min_weight_value/max_weight_value- FLOAT, −5 to 5, defaults 0.0 and 1.0.max_weight_tags- INT, 1–100, default 1 (one word gets weighted).order- enum:RandomorOrdered.
Output: STRING, the weighted prompt.
Installing it
Part of the Ranbooru pack: ComfyUI Manager, search "Ranbooru", or
cd ComfyUI/custom_nodes
git clone https://github.com/Inzaniak/comfyui-ranbooru
then restart. No requirements.txt - the pack only uses ComfyUI's bundled Python packages.
Common issues
The big one is model choice, and it's worth being blunt about it. (word:weight) is a CLIP-era feature. The KB's prompt-engineering research is unambiguous: on LLM-encoded checkpoints (the 2026 generation - Z-Image, Flux 2 Klein, Anima, and friends), the encoder wrapper passes disable_weights=True and the weight is silently discarded. So this node does nothing on those models. If you're on the SDXL-anime line it was built for, it works as advertised - just remember that Random mode skips tags that already have parens, so a prompt you've already hand-weighted won't get double-weighted. And because Ordered weights the first N tags regardless of what they are, a leading masterpiece can eat your weight slot; the Random mode is the more interesting default for roulette use.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | — | |
| separator | STRING | , | — |
| min_weight_value | FLOAT | 0.00-5–5 | — |
| max_weight_value | FLOAT | 1.00-5–5 | — |
| max_weight_tags | INT | 11–100 | — |
| order | COMBO | Random | 2 options: Random, Ordered |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |