Nodes/Bjornulf_custom_nodes/๐ŸŽฒ Random (Texts)
ComfyUI Node

๐ŸŽฒ Random (Texts)

Pull several random picks from a list, run them all in one click

By justUmenยทCreated 2 years agoยทUpdated about a year agoยท 545
๐ŸŽฒ Random (Texts)
    • STRING
    โ—„number_of_inputs2โ–บ
    โ—„number_of_random1โ–บ
    โ—„seed0โ–บ

    This node does two things most "random text" tools don't combine: it picks randomly from a list and it can grab more than one pick at a time, running your full pipeline once per selection in a single Queue click. Wire in ten prompt options, ask for three random picks, and you get three full generations from three different (randomly chosen) prompts without touching the queue button again.

    How it works

    Set number_of_inputs to how many text options you're offering (2 to 30) and wire a text source into each. Then set number_of_random to how many of those options you actually want picked per run - leave it at the default of 1 for a simple single random choice, or raise it to sample several at once. seed controls the selection, with the usual fixed/increment/decrement/randomize control widget deciding whether repeated runs give you the same picks or fresh ones.

    The output is a STRING list, not a single string - which matters mechanically: when number_of_random is greater than 1, ComfyUI's list execution kicks in and runs everything downstream of this node once per selected string, all within one prompt execution. Set number_of_random to 3 and you don't get one string with three lines in it - you get three separate full runs through the rest of your graph.

    Great for creating random prompts from a curated bank of ideas, especially when you want a sample rather than either "always the same one" or "run through the entire list." That middle ground - a few random picks out of many options - is the thing this node adds over the pack's simpler single-pick text nodes.

    The inputs and outputs that matter

    • number_of_inputs (2โ€“30, default 2) - how many text options are on offer.
    • number_of_random (1โ€“30, default 1) - how many of those options get picked and run, per queue.
    • seed (default 0) - controls the selection; pair with the control widget for reproducibility.
    • Output: a STRING list - one entry per selected option, fanning out downstream execution once per item.

    How to install it

    Through ComfyUI Manager: search Bjornulf_custom_nodes, install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/justUmen/Bjornulf_custom_nodes
    

    cd into the folder, pip install -r requirements.txt (a venv is worth setting up), restart ComfyUI. No dependency specific to this node beyond the shared pack requirements.

    Common issues

    The most common surprise is scale, not a bug: since raising number_of_random means the entire rest of your graph runs once per pick, setting it high with a slow checkpoint attached can turn what looked like a one-click test into a genuinely long batch. Do the arithmetic - number_of_random full generations, not one - before you queue it against anything expensive.

    Make sure number_of_random doesn't exceed number_of_inputs; you can't sample more options than you've actually wired in. And if repeated runs keep giving you the exact same selection when you expected variety, check the seed's control widget - it's easy to leave on fixed without noticing.

    CategoryBjornulf

    Inputs (3)

    NameTypeDefaultDescription
    number_of_inputsINT22โ€“30โ€”
    number_of_randomINT11โ€“30โ€”
    seedINT0โ€”

    Outputs (1)

    NameTypeDescription
    STRINGSTRINGโ€”