ComfyUI Node

ABC Random

Roll a number that still respects your sweet spot

By TinyBeeman·Created about a year ago·Updated 16 days ago· 1
ABC Random
    • rnd_float
    • rnd_int
    ◄val10.00►
    ◄val20.50►
    ◄val31.00►
    ◄modeuniform►
    ◄seed0►

    What it's for

    Plain random is a bad tuning tool. If you already know CFG 4.5 looks right, a uniform random 1–20 gives you a pile of junk runs for every one worth keeping. ABC Random solves exactly that: you hand it three numbers, and it treats the middle one as the value you trust, so most draws land near it and only a minority wander off.

    That makes it the node you reach for when you want twenty variations of a good setting instead of twenty variations of nothing. Convert your CFG, denoise, or LoRA-strength widget to an input, wire rnd_float in, and queue a batch.

    How it works

    The first thing it does is sort your three values - a, b, c = sorted([val1, val2, val3]) - so you can't get the order "wrong". The one you intend as the center just has to be numerically between the other two.

    Then it splits the probability in half: the author's own docstring says exactly 50% of the probability falls between [a, b] and 50% between [b, c]. That split is by count, not by width, which is the important consequence - make one half narrow and it gets hammered, hard. In uniform you get a visible density cliff at the center value.

    The five modes are the interesting part:

    • uniform - piecewise-flat with that 50/50 split. Blocky, and the edges are just as likely as the middle.
    • triangular - peaks at the center and tapers to zero at the outer bounds. The polite option: you'll never see an extreme.
    • staircase - 40% of draws concentrate in the tight middle stretch around the center, the rest spread out baseline across the halves. A blocky bump rather than a slope.
    • trapezoidal - smooth slope up from the low bound, flat plateau through the center, slope down to the high bound. The nicest of the bunch for parameter sweeps.
    • ignore_center - throws the center away and is plain uniform across the outer two values.

    Inputs and outputs you care about

    val1, val2, val3 (FLOAT, defaults 0 / 0.5 / 1 - i.e. it defaults to a 0-to-1 dial centered at 0.5, which is denoise and LoRA strength territory), then mode, then seed (INT, with control_after_generate attached, so fixed gives you the same number forever and randomize re-rolls each queue).

    Two outputs. rnd_float is the number itself. rnd_int is that same number run through int() - truncated, not rounded. Two things fall out of that:

    • Wire rnd_float into anything that takes a float. Right-click the target widget → Convert widget to input, then connect.
    • For an integer target like steps, feed whole numbers and remember the top one is nearly unreachable: with val3 = 20 you'll see 20 only if the float lands exactly on it. Practically you get 10–19. Set val3 = 21 if you want 20 in play.
    • Between 0 and 1 rnd_int is almost always 0.

    Installing it

    It ships in the ComfyUI-TinyBee pack (under 🐝TinyBee/Util), and it's one of the genuinely painless installs in this ecosystem: requirements.txt lists pillow, the README notes every dependency is Python standard library, and there are no model files to download.

    Search ComfyUI-TinyBee in ComfyUI Manager, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/TinyBeeman/ComfyUI-TinyBee
    

    Restart ComfyUI. The node shows up in the Add Node menu under 🐝TinyBee/Util as "ABC Random".

    Where people get burned

    If all three values are identical, the node short-circuits and returns that value - constant output, no randomness, and it looks like the node is broken. That's the design, not a bug.

    The seed widget is the usual trap. control_after_generate fires after the run by default, so the number shown in the box is the one that will be used next, not the one that just produced the image you're looking at. If you find a good draw, flip the setting and set ComfyUI's global "widget control mode" to Before once - otherwise you lose the seed you wanted to keep.

    And the tuning discipline that makes this node actually useful: change one variable at a time on a locked seed. Randomizing CFG, denoise and steps simultaneously just tells you that something changed.

    Category🐝TinyBee/Util

    Inputs (5)

    NameTypeDefaultDescription
    val1FLOAT0.00—
    val2FLOAT0.50—
    val3FLOAT1.00—
    modeCOMBOuniform5 options: uniform, triangular, staircase, trapezoidal, ignore_center
    seedINT00–18446744073709550000—

    Outputs (2)

    NameTypeDescription
    rnd_floatFLOAT—
    rnd_intINT—