Nodes/AUN ComfyUI Nodes/Random Boolean
ComfyUI Node

Random Boolean

One switch for 'on, off, or flip a coin'

By loz2754·Created 8 months ago·Updated about 20 hours ago· 5
Random Boolean
    • Boolean
    • Label (when True)
    stateFalse
    labellabel

    Every ComfyUI workflow eventually needs a switch, and most switch nodes force you to chain two separate booleans together if you want randomness. AUNBoolean - displayed as "Random Boolean" in the node menu - collapses all of that into one dropdown: True, False, or Randomize. That third option is the whole reason to install this over stock ComfyUI's plain Primitive Boolean node.

    Set the state dropdown to True and the Boolean output fires true every run. False fires false. Randomize flips a fair coin on every execution - a true 50/50, re-evaluated each run thanks to the node's IS_CHANGED hook, which tells ComfyUI the node's output may differ even though no input changed. In practice this is the node you drop in when you want a batch to explore both sides of a branch: half the renders take path A, half take path B, no manual toggling.

    The second output is the sleeper feature. Label (when True) is a string you set via the optional label input, and the node outputs it when the boolean resolves true and an empty string otherwise. That's a filthy trick for automation: wire that string into a filename builder or a show-text node and your filenames will literally tell you which branch ran. "A/B test run - sharp" versus "A/B test run -". Or use it to drive AUN's own label-based filename tokens. The boolean itself is the conventional output that switches between two of anything - two models via a switch node, two prompts, two CFG values, two sampler setups - so one coin flip can branch your whole graph.

    Worth knowing: the label defaults to the literal string "label", so if you don't care about the label output, either ignore it or set it to something meaningful. And there's no seed control here - if you need reproducible randomness you'd feed a fixed random boolean into this, which is a slightly different use case than this node is for.

    It's part of the AUN pack, installed the usual way: ComfyUI Manager (search "AUN"), or cd ComfyUI/custom_nodes && git clone https://github.com/loz2754/AUN-ComfyUI-Nodes and restart. No models, no heavy deps beyond the pack's piexif/opencv-python-headless/imageio-ffmpeg/requests. If you cloned manually and hit ModuleNotFoundError: piexif or cv2, pip install -r custom_nodes/AUN-ComfyUI-Nodes/requirements.txt sorts it. This is one of the first nodes the pack's author suggests beginners play with, and for good reason - it's the smallest possible demonstration of how a boolean can control a real branch.

    CategoryAUN Nodes/Logic

    Inputs (2)

    NameTypeDefaultDescription
    stateCOMBOFalseSelect True, False, or Randomize (re-evaluates each run).
    labeloptSTRINGlabelOptional text label to identify this boolean in your workflow.

    Outputs (2)

    NameTypeDescription
    BooleanBOOLEAN
    Label (when True)STRING