Even or Odd
Turn an integer into a boolean switch
- bool_Odd_True
- result
Even or Odd checks whether an integer is even or odd and gives you a boolean out of it. Odd is True, even is False. That's it - but it's a genuinely useful little primitive, because it turns any number in your workflow, most obviously a seed, into a coin flip that changes every generation.
It's a Logic node in ComfyUI_Mira, mirabarukaso's utility pack. The intended use in the author's own workflows is to wire a seed (or a seed scaled down) into it and use the resulting boolean to switch something - a text variant, which of two prompts leads, whether a region toggle is on. Because the seed changes per run, you get automatic variation without touching anything by hand. It's a small idea that does real work in a batch.
How it works
The node takes the integer, checks its parity, and outputs a boolean plus a human-readable string. Odd numbers give True; even numbers give False. There's no threshold or math to tune - parity is parity. The result string just spells out which it was, so you can drop a ShowText node on it and confirm what happened on a given run.
The magic isn't in the node, it's in what you feed it. A raw seed flipping between even and odd is effectively a 50/50 boolean that reseeds itself every queue. Chain the boolean into a Text Switcher, a function swap, or a Boolean List Interpreter and you've got seed-driven randomness in your composition.
Inputs and outputs that matter
num- the integer to test. Connect a seed here for per-generation flipping, or any integer you want to branch on.
Outputs:
bool_Odd_True- the boolean.Truewhennumis odd,Falsewhen even.result- aSTRINGdescribing the outcome, useful on a ShowText node for sanity-checking.
Installing it
ComfyUI Manager: search ComfyUI_Mira in the Custom Nodes Manager, Install, restart. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/mirabarukaso/ComfyUI_Mira.git, then restart ComfyUI. If the pack errors on load, pip install -r requirements.txt in its folder and restart. No models.
Common issues
The behavior is dead simple, so problems are usually about what's upstream. If you want it to flip every run, the number feeding it has to actually change every run - a fixed seed gives you the same boolean forever. If you're driving it from a seed that's on "fixed," that's why nothing varies.
One thing worth knowing from the pack's own notes on seed handling: ComfyUI's randomize-versus-fixed toggle has a quirk where switching from fixed back to randomize can take two queues to take effect, which the author suggests solving with Inspire Pack's Global Seed node. If your even/odd switch seems a run behind after you re-enable randomization, that's the ComfyUI seed timing, not this node. Otherwise it's about the most predictable node in the pack - odd is true, even is false, done.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| num | INT | 1 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| bool_Odd_True | BOOLEAN | — |
| result | STRING | — |