Nodes/ComfyUI_EmAySee_CustomNodes/EmAySee Random String Selector
ComfyUI Node

EmAySee Random String Selector

A coin flip between two prompts, wrapped in a node

By EmAySee·Created about a year ago·Updated 4 months ago· 2
EmAySee Random String Selector
    • RANDOM_SELECTED_STRING
    string_input_1Input String 1
    string_input_2Input String 2

    Two strings in, one random string out. The simplest member of the pack's random-string family: you type string_input_1 and string_input_2, and every run the node flips a coin - random.randint(0, 1) - and returns whichever input won. That's the entire mechanism. It's the "A/B toggle that randomizes" node.

    How it works

    Just the two string inputs (both with a placeholder default you'll overwrite) and one output, RANDOM_SELECTED_STRING. Wire it into a CLIP Text Encode, a filename prefix, a text combine - anything that takes a string. The flip is unbiased and independent every time the graph runs, so you get a true 50/50 split across a batch.

    The missing knob: no seed

    There's no seed input and no reproducibility toggle. Every execution rolls fresh from Python's global RNG, so you cannot replay "the same pick" for a given run. For variety that's ideal - no widget fiddling, it just varies. For reproducible experiments it's a non-starter, and that's where the pack's 20-way selector (EmAySee_RandomStringSelector) wins, since it at least takes a seed.

    When to use it

    • Two competing positive prompts and you want the graph to decide.
    • A positive/negative-style choice where you don't want to hard-code which branch runs.
    • Any 2-way variation you're tired of toggling by hand.

    Honestly, if you only need two options, most bigger utility packs (rgthree-style switches, etc.) will also do this and more. Where this node earns its place is as the minimal, dependency-free version - it's already installed if you have the pack, it's dead simple, and it never gets in the way. It's also the one to grab when you want a 2-way pick and don't want to configure a switch with bypasses and default states.

    Installing it

    Part of ComfyUI_EmAySee_CustomNodes - install once, get all the nodes. ComfyUI Manager → search ComfyUI_EmAySee_CustomNodes → Install, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/EmAySee/ComfyUI_EmAySee_CustomNodes
    # restart ComfyUI
    

    Under EmAySee_Utils. No dependencies.

    Bottom line

    It's a two-line random choice with a UI around it. Nothing fancy, nothing hidden - which is exactly why it keeps being useful. Want three options? The same pack has the ThreeChoice version, and a FourChoice after that.

    CategoryEmAySee_Utils

    Inputs (2)

    NameTypeDefaultDescription
    string_input_1STRINGInput String 1
    string_input_2STRINGInput String 2

    Outputs (1)

    NameTypeDescription
    RANDOM_SELECTED_STRINGSTRING