Nodes/Latent Tools/LTNumberRangeGaussian
ComfyUI Node

LTNumberRangeGaussian

Randomize any parameter with a bell curve, not a flat dice roll

By Machines-of-Disruption·Created about a year ago·Updated 8 months ago· 27
LTNumberRangeGaussian
    • FLOAT
    • INT
    • STRING
    mean0.0000
    std1.0000
    seed0

    Want 100 images where cfg, steps, and denoise drift a little between runs instead of sitting glued to one value? Wire this node into those fields, hit queue, and every run rolls a fresh number drawn from a normal distribution. It's the batch-generator's friend: one tiny node that turns "explore around a value" into a push of a button.

    What it actually does

    LTNumberRangeGaussian is a helper from the latent-tools pack. Its entire job is to emit one random float from a Gaussian (normal) distribution - a bell curve - using the mean, standard deviation, and seed you set. The same value comes out in three shapes at once, so you can plug it into nearly any input widget downstream:

    • FLOAT - the raw result, for float inputs like denoise or a LoRA strength.
    • INT - the same value truncated to an integer, for things like steps.
    • STRING - for nodes that want text.

    The three inputs that matter

    • mean - where the bell sits, default 0. Your "typical" value.
    • std - how spread out rolls are, default 1. Crank it and you get wild outliers; shrink it and every roll hugs the mean.
    • seed - default 0, with the usual "control after generate" widget. Leave it fixed to replay the same values; randomize it to get a fresh draw every queue.

    That's it. No optional inputs, no surprises.

    How it works

    Under the hood it's random.Random(seed).gauss(mean, std) - Python's normal distribution. The upshot for you: most rolls land near the mean (about 68% fall within one std of it), with occasional excursions into the tails. That's the whole reason to pick Gaussian over its sibling LTNumberRangeUniform. For something like cfg, you usually want most runs near your working value and the occasional surprise, not an even spread across the range.

    The seed makes it deterministic: same seed, same value, reproducible batch. That's not just nice - it's what lets you treat each image as a data point.

    Putting it to work

    The README's own example is the pattern to steal. It randomizes the noise itself: the Gaussian noise latent's std is a random value with mean 1 and std 0.5, clipped at 0.1 on the low end with a ComfyMath node; steps get a uniform draw between 5 and 40; cfg gets a Gaussian with mean 8 and std 1, also clipped. Then it cranks out 100 images and watches the parameter space get covered.

    Gotchas

    Two things burn people. First, the INT output truncates, it doesn't round - and nothing stops a draw from going negative. A Gaussian with mean 8 and std 1 can hand you cfg = 6.2, and if you're using the INT output for steps it can dip to a single digit. Clip the tails with a ComfyMath node before the value goes into anything sensitive.

    Second, remember that sweeps only mean something if your sampler converges. On a fixed seed, comparing outputs across runs only tells you about your one changed variable if the sampler settles - Euler, DPM++ 2M, that family. Ancestral samplers add their own noise every step, so your "one variable at a time" discipline quietly stops working.

    Installing it

    latent-tools is a small MIT-licensed pack by xl0 (Alexey Zaytsev), published on the Comfy Registry. Easiest path: ComfyUI Manager → Install Custom Nodes → search for "Latent Tools" and install, then restart ComfyUI. Manual path is the same as any custom node:

    cd ComfyUI/custom_nodes
    git clone https://github.com/xl0/latent-tools
    

    Restart ComfyUI and the node shows up under the LatentTools category. The only Python dependency is lovely-tensors; there are no model files to download. Honest caveat: this is a niche, near-zero-hype pack from a single author, so it won't appear in most workflows you download - but it's tiny, dependency-light, and easy to read if you want to audit what it does.

    CategoryLatentTools

    Inputs (3)

    NameTypeDefaultDescription
    meanFLOAT0.0000-1000000–1000000
    stdFLOAT1.00000.00001–1000000
    seedINT00–18446744073709550000

    Outputs (3)

    NameTypeDescription
    FLOATFLOAT
    INTINT
    STRINGSTRING