Files
2026-07-20 17:43:04 +09:00

60 lines
1.8 KiB
Markdown

# ComfyUI Random Switch
A ComfyUI custom node that randomly selects one input from multiple inputs of the same type.
## Features
- **Random Selection**: Randomly pick one value from 2-32 inputs
- **Flexible Input Types**: Accepts any type (images, latents, conditioning, etc.) as long as all inputs are the same type
- **Seed Control**: Use an external seed for reproducible results, or auto-generate a seed on each run
- **Dynamic Input Growth**: UI automatically expands to show the next input when all current inputs are connected
## Installation
1. Clone or download this repository into your ComfyUI `custom_nodes` directory:
```bash
cd ComfyUI/custom_nodes
git clone https://github.com/tttamaki/Comfyui-RandomSwitch.git
```
2. Restart ComfyUI
## Usage
### Basic Setup
1. Add the **Random Switch** node to your workflow (search for "Random Switch")
2. Connect 2 or more inputs (images, latents, etc.) - all must be the same type
3. The node will randomly select and output one of the connected inputs
### With Seed Control
- Leave **seed** at `0` to get a random selection each run
- Connect a seed value for reproducible results (same seed = same selection)
- The node outputs both the selected value and the seed used
### Example Workflows
- **Random Image Selection**: Connect multiple images and randomly pick one
- **Random Latent Selection**: Use with latent inputs for probabilistic sampling
- **Random Conditioning**: Switch between different conditioning inputs
## Inputs
- **inputs** (Autogrow): 2-32 inputs of any type (must all be the same type)
- **seed** (Int): Random seed for reproducibility (0 = auto-generate)
## Outputs
- **output** (Any): The randomly selected input value
- **seed** (Int): The seed value that was used
## License
MIT License
## Author
tttamaki and GitHub Copilot