Nodes/SDXL Auto Prompter/APNext Random String Picker
ComfyUI Node

APNext Random String Picker

Randomly pick one of two strings, seeded

By dagthomas·Created 3 years ago·Updated 13 days ago· 283
APNext Random String Picker
    • output
    string1
    string2
    seed0

    RandomStringPicker (APNext Random String Picker) is a small routing utility: give it two blocks of text and it hands back one of them at random. That's it. It's the string equivalent of flipping a coin between two options, and it slots neatly into the pack's other "make each run different" nodes when you want to alternate between two prompt variants without rebuilding the graph.

    How it works

    Two inputs, one output:

    • string1 and string2 - both multiline, so each can hold a full prompt, a style block, or a single word. The node returns one of the two.
    • seed (optional, default 0) - controls the pick so it's reproducible; change it (or let it randomize each queue) to flip which string comes out.
    • Output: a single output STRING.

    Because the inputs are multiline, you're not limited to short tokens - drop an entire alternative prompt into each side and the node alternates between two complete looks. Wire the output into your text encode, or into another node that takes a string.

    Where it's handy

    The obvious use is A/B variety: put two different subjects, two lighting setups, or two style descriptions in the two slots and batch - roughly half your outputs go one way, half the other, and you get a mixed set from one queue. Chain a few of these and you can build a crude branching prompt without a full wildcard system. It's blunt (two options, not a weighted list), but for "give me a mix of these two" it's the fastest thing in the box.

    Installing it

    ComfyUI Manager: search comfyui_dagthomas, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/dagthomas/comfyui_dagthomas
    cd comfyui_dagthomas
    pip install -r requirements.txt
    

    No API key, no model downloads - it's pure Python. Runs regardless of whether the pack's LLM nodes can reach a provider.

    Common issues

    It keeps picking the same string. With a fixed seed, the pick is deterministic - same seed, same choice, every run. If you want it to actually alternate across a batch, let the seed randomize each queue rather than pinning it.

    I wanted a weighted or multi-option pick. This node only chooses between two inputs, evenly. For more options or weighting, chain several pickers, or use the category-based prompt nodes in this pack (Keywords, Poses, Plots) with their Random settings, or a dedicated wildcard node.

    Only one side ever fires. Both string1 and string2 are required - if one is empty, half your outputs will be blank. Fill both, or expect gaps.

    Categorycomfyui_dagthomas

    Inputs (3)

    NameTypeDefaultDescription
    string1STRING
    string2STRING
    seedoptINT00–18446744073709550000

    Outputs (1)

    NameTypeDescription
    outputSTRING