ComfyUI Node

Randomizer

An A/B LoRA-and-prompt switcher that runs on a seed

By idrirap·Created 3 years ago·Updated about a year ago· 268
Randomizer
  • lora_1
  • lora_2
  • text
  • lora stack
text_1
text_2
seed0

Randomizer is one of the side nodes the author admits to "keeping here" while building the LoRA trigger-word pack, and it does exactly one thing: takes two prompt strings, optionally two LoRA stacks, and returns one pair at random. It's the smallest possible solution to "I want to A/B two character LoRAs without editing the graph."

The appeal is the wiring. Because it outputs a STRING for the prompt and a LORA_STACK together, you can feed one branch into a text encoder and the other into a stacked loader, and the seed decides which combo actually runs. Change the seed, get the other one. It's a crude but genuinely handy way to compare, say, two style LoRAs against the same base prompt without manually bypassing nodes.

How it works

The mechanism is charmingly simple, and it's worth knowing before you trust it for "random" sampling: Randomizer just checks whether the seed is even.

if seed % 2 == 0:
    return (text_1, lora_1)
return (text_2, lora_2)

So you get exactly two outcomes, determined by seed parity. Even seed → branch 1, odd seed → branch 2. That's a coin flip, not a distribution - if you wanted a roulette wheel over a dozen prompts, this isn't it. But for a straight A/B comparison it's perfect, and being deterministic per seed is actually a feature: lock a seed and you get a reproducible branch, which is what you want when you're trying to isolate whether the LoRA or the prompt moved the needle. The seed input is the full 0 to 2⁶⁴ range, and the two LORA_STACK inputs are optional - leave them disconnected and it's just a text picker.

The outputs are named text and lora stack. Both come out of whichever branch won, so you never get a mismatched prompt+stack pairing. Wire text into your CLIP Text Encode and lora stack into whatever consumes a stack (efficiency-nodes style loaders, or the stacked loaders from this same pack).

Installing

It's part of ComfyUI-Lora-Auto-Trigger-Words. Install via ComfyUI Manager (search "ComfyUI-Lora-Auto-Trigger-Words") and restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/idrirap/ComfyUI-Lora-Auto-Trigger-Words

No model downloads, no extra dependencies for this node. The one thing to remember: it only ever picks between two options, and the choice is parity, not a real random draw. If your mental model was "randomizer = shuffle many," adjust your expectations - this one is a binary switch wearing a party hat.

Categoryautotrigger

Inputs (5)

NameTypeDefaultDescription
text_1STRING
text_2STRING
seedINT00–18446744073709550000
lora_1optLORA_STACK
lora_2optLORA_STACK

Outputs (2)

NameTypeDescription
textSTRING
lora stackLORA_STACK