๐ฆ RS Loop Switch
Cycle a seed (or any INT) across a batch โ the poor man's batch scheduler
- INT
Running a batch of generations with a different seed each time usually means the fixed-seed workflow, or a janky counter node, or manually editing between runs. ๐ฆ RS Loop Switch (RaykoLoopSwitchSeed) is a dedicated answer: it cycles through up to ten INT values, one per queue step, and emits the right one for each generation. Its obvious use is seeds, but since it outputs a plain INT it'll drive any integer input - steps, CFG, batch counts, whatever.
How it works
You give it ten value_N slots (seeds, typically) and a step window. On each execution it computes a "step number" from your start_at_step, end_at_step, and jump, then picks the value with (step - 1) % 10 - so with ten values and no jump, iteration one gets value_1, iteration two gets value_2, and so on, wrapping at ten. The output is a list of INTs (that's the OUTPUT_IS_LIST flag), which is how it hands a different value to each queued prompt.
The control_before_generate dropdown adds the automation layer: fixed just uses your values as typed, while increment, decrement, or randomize modify the whole set before each run - increment adds 1 to every seed per run, randomize rolls new random seeds entirely. Because of that, IS_CHANGED returns NaN for the non-fixed modes, which forces ComfyUI to re-execute it every run instead of caching.
Inputs that matter
value_1โฆvalue_10- your seed pool. Range goes up to ~9.8 quadrillion, so any real seed fits.start_at_step,end_at_step- the window of queue steps this runs across.jump- step interval (default 1). A jump of 2 means it cycles every other generation.control_before_generate-fixed,increment,decrement, orrandomize.
Output: INT (a list) - wire it into KSampler's seed (or steps, or any INT input).
How to install
Part of ComfyUI_RaykoStudio:
cd ComfyUI/custom_nodes
git clone https://github.com/Raykosan/ComfyUI_RaykoStudio.git
Restart ComfyUI, or install via ComfyUI Manager (search "ComfyUI_RaykoStudio"). No extra dependencies.
Common issues
- Same seed every run. If your downstream
KSamplerhas "control_after_generate" set to fixed, or the seed input is wired to something else, this node's cycling won't matter. Make sure the KSampler's seed actually comes from this node's output. - Feels out of sync. The step counting starts at
start_at_step, not at your batch count. If you queue mid-way through a run, the count carries on from where it was - setstart_at_stepto 1 for a clean start. - Randomize surprises.
randomizereplaces all ten values with new random seeds each run, so your "favorite seed" isn't in the pool anymore. Useincrementif you want the pool to stay yours.
The honest take: it's a focused little node that does one thing well - auto-cycling seeds across a batch - and it sits in the long tradition of ComfyUI batch-scheduler utilities. If you only ever generate single images, skip it. If you batch, it saves you the counter-node gymnastics.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| start_at_step | INT | 1-10000โ10000 | โ |
| end_at_step | INT | 10-10000โ10000 | โ |
| jump | INT | 11โ1000 | โ |
| control_before_generate | COMBO | 4 options: fixed, increment, decrement, randomize | |
| value_1 | INT | 00โ9888888888888888 | โ |
| value_2 | INT | 00โ9888888888888888 | โ |
| value_3 | INT | 00โ9888888888888888 | โ |
| value_4 | INT | 00โ9888888888888888 | โ |
| value_5 | INT | 00โ9888888888888888 | โ |
| value_6 | INT | 00โ9888888888888888 | โ |
| value_7 | INT | 00โ9888888888888888 | โ |
| value_8 | INT | 00โ9888888888888888 | โ |
| value_9 | INT | 00โ9888888888888888 | โ |
| value_10 | INT | 00โ9888888888888888 | โ |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | โ |