Nodes/ComfyUi-MpiNodes/Mpi If Else Probability Inverted
ComfyUI Node

Mpi If Else Probability Inverted

Route a value down a random branch

By MadPonyInteractive·Created 11 months ago·Updated 5 days ago· 3
Mpi If Else Probability Inverted
  • input
  • true
  • false
  • boolean
  • seed
probability0.50
seed0

Mpi If Else Probability Inverted is the flip side of MpiIfElseProbability, and the naming actually tells you which shape you're getting. The plain version takes two inputs and hands you one output - a selector. This one takes one input and sends it to one of two outputs - a router. Same dice, different plumbing, and it's the one you want when you've got a single value and two competing downstream branches to point it at.

Here's the setup: input accepts any type, then probability and seed do exactly what they do in its sibling - 0.0 always routes to false, 1.0 always to true, 0.5 is fifty-fifty, and the pick is deterministic for a given seed thanks to the same seed-hash trick. Out the other side you get true, false, plus boolean (which way it went) and seed (echoed for chaining). The value you pushed in appears on whichever output won; the losing output is dead - it's an ExecutionBlocker, so nothing downstream of it runs at all.

That "nothing downstream runs" bit is the whole point. Say you've got one prompt list and two style LoRA chains, and you want a random pick each run: wire the prompt into input, the two chains off true and false, and the chosen branch executes while the other silently skips. Because the dead output carries a blocker rather than a dummy value, you don't need to worry about a graph that half-runs and then fails when the ignored branch turns out to be missing something. It's the same lazy-evaluation philosophy the pack applies to its if/else family: don't compute what you didn't pick.

So when do you grab the inverted one instead of the selector? When the thing being decided is one value that must go somewhere, rather than two values of which one wins. A prompt, a seed, a model - a single object that takes two possible futures. The non-inverted node is for "which of these two alternatives do I emit?"; this one is for "where does this thing go?"

Installing is the same story as the rest of the pack - no pip requirements, just ComfyUI Manager (search "ComfyUi-MpiNodes") or:

cd ComfyUI/custom_nodes
git clone https://github.com/MadPonyInteractive/ComfyUi-MpiNodes

Restart, and it's under the MpiNodes > Logic menu. One gotcha worth remembering: with the default seed of 0 the coin lands the same way every single run, so if your "random" workflow keeps picking the same branch, that's the fixed seed talking - feed it a moving seed source and it'll behave like you expected. And since both probability nodes share that seed math, a given seed will pick the same result (true/false) in both of them - handy when you want a coin toss that stays consistent across two decisions in one graph.

CategoryMpiNodes/Logic

Inputs (3)

NameTypeDefaultDescription
input*
probabilityFLOAT0.500–10.0 will always output 'false' and return False 1.0 will always output 'true' and return True 0.5 gives both a 50% chance
seedINT00–18446744073709550000

Outputs (4)

NameTypeDescription
true*
false*
booleanBOOLEAN
seedINT