Random Text Index Switch
Random prompt picker with the index generator built in
- text
- label
- index
The classic ComfyUI prompt-rotation recipe is two nodes: a Random/Select INT to make an index, then a Text Index Switch to pick the matching text. Random Text Index Switch fuses those into one node - it generates the index and does the selection, with up to 20 text inputs, in a single place. Fewer nodes, fewer wires, fewer chances to mismatch your range against your socket count. It's the "one node instead of two" upgrade, and it's a genuine QoL win.
How it works
It has the same three modes as Random/Select INT - Select (fixed select value), Increment (cycle minimum→maximum), and Random (random within the range) - but instead of just outputting an index, it uses that index to pick one of the text1…text20 inputs and outputs the text. Three outputs: text (the picked string), label (a label for it), and index (the active index, in case something downstream needs to stay in sync).
The inputs worth knowing:
minimum/maximum- the selection range. Set these to your actual number of filled text slots, not 20, or you'll roll empty sockets.mode- Select/Increment/Random.select- the fixed index for Select mode.visible_inputs(2–20) - how many text sockets render on the node. Drop it to keep the node tidy when you only use five of twenty.
Why you'd use it over the two-node combo
- One place to configure. The range that controls the index and the number of text sockets you configured are right next to each other, so the classic "range doesn't match socket count" bug is much harder to hit.
- The
labeloutput. The two-node pattern doesn't give you a label; this does. Wirelabelinto a display node or use it for filenames via an AUN filename builder - knowing which prompt won without reading the whole text is genuinely handy. - Cleaner canvas. One node instead of two is the entire ethos of the AUN pack.
Honest trade-off: if you need the same index to drive a text switch and a LoRA loader or a controller, the two-node pattern lets you split one index to multiple places. Here you'd take the index output and wire it onward - same effect, just remember the range you set is what the node uses, so keep it consistent.
Install
Part of AUN ComfyUI Nodes (loz2754):
cd ComfyUI/custom_nodes
git clone https://github.com/loz2754/AUN-ComfyUI-Nodes
or ComfyUI Manager → search "AUN ComfyUI Nodes" → install → restart. Pack deps (piexif, opencv-python-headless, imageio-ffmpeg, requests) install via Manager; no model files, no keys.
If your rotation needs Range-list mode (like 1,2,5-8), note this node is Select/Increment/Random only - pair AUN Random/Select INT with the pack's AUN Text Index Switch for that. For the everyday "randomize my prompts" job, this is the one.
Inputs (25)
| Name | Type | Default | Description |
|---|---|---|---|
| minimum | INT | 11–20 | The minimum index for selection (inclusive). |
| maximum | INT | 101–20 | The maximum index for selection (inclusive). |
| mode | COMBO | Random | Select mode: Select for fixed index, Increment for cycling through range, Random for random index within range. |
| select | INT | 11–20 | The fixed index value to output when in 'Select' mode. |
| visible_inputs | INT | 202–20 | How many text input sockets to expose on the node (2-20). |
| text1opt | STRING | Text input 1. Only the selected index is output. | |
| text2opt | STRING | Text input 2. Only the selected index is output. | |
| text3opt | STRING | Text input 3. Only the selected index is output. | |
| text4opt | STRING | Text input 4. Only the selected index is output. | |
| text5opt | STRING | Text input 5. Only the selected index is output. | |
| text6opt | STRING | Text input 6. Only the selected index is output. | |
| text7opt | STRING | Text input 7. Only the selected index is output. | |
| text8opt | STRING | Text input 8. Only the selected index is output. | |
| text9opt | STRING | Text input 9. Only the selected index is output. | |
| text10opt | STRING | Text input 10. Only the selected index is output. | |
| text11opt | STRING | Text input 11. Only the selected index is output. | |
| text12opt | STRING | Text input 12. Only the selected index is output. | |
| text13opt | STRING | Text input 13. Only the selected index is output. | |
| text14opt | STRING | Text input 14. Only the selected index is output. | |
| text15opt | STRING | Text input 15. Only the selected index is output. | |
| text16opt | STRING | Text input 16. Only the selected index is output. | |
| text17opt | STRING | Text input 17. Only the selected index is output. | |
| text18opt | STRING | Text input 18. Only the selected index is output. | |
| text19opt | STRING | Text input 19. Only the selected index is output. | |
| text20opt | STRING | Text input 20. Only the selected index is output. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| label | STRING | — |
| index | INT | — |