Nodes/Latent Tools/LTNumberRangeUniform
ComfyUI Node

LTNumberRangeUniform

LTNumberRangeUniform

By Machines-of-Disruption·Created about a year ago·Updated 8 months ago· 27
LTNumberRangeUniform
    • FLOAT
    • INT
    • STRING
    min_value0.0000
    max_value1.0000
    seed0

    The flat-dice version of the batch-randomizer story. LTNumberRangeUniform from latent-tools draws a random value where every number between your minimum and maximum is equally likely. No bell curve, no preference for the middle - just an even spread across the range, one fresh roll every time you queue.

    What it is

    It's a tiny helper with one job: output a random float in a range you define. Like its sibling LTNumberRangeGaussian, it hands you the same value in three forms so it can plug into whatever input widget you're randomizing:

    • FLOAT - the raw result, for float inputs.
    • INT - truncated to an integer, for step counts and the like.
    • STRING - for text-bound widgets.

    The inputs

    • min_value - the low end of the range, default 0.
    • max_value - the high end, default 1.
    • seed - default 0, with the "control after generate" randomize option. Fixed seed = same value every run; randomized seed = new value each queue.

    Three inputs, three outputs, zero mystery.

    How it works

    random.Random(seed).uniform(min_value, max_value) - a uniform draw scaled to your range. Every value in between is as likely as every other. One quirk worth knowing: if you accidentally set min_value higher than max_value, Python's uniform silently reverses and draws within the swapped range rather than erroring. Nothing crashes, but read your range left-to-right to keep your sanity.

    When uniform beats Gaussian

    Think of it as exploration strategy. A uniform draw guarantees full coverage: run 50 images with LoRA strength uniform over 0–1.5 and you'll see the whole spread, including the extremes. A Gaussian draw (LTNumberRangeGaussian) barely ever visits the tails - it's for "stay near my working value, with occasional surprises." So:

    • Want to map an entire range and see everything it does? Uniform.
    • Want most runs near a known-good value? Gaussian.

    The README's batch example uses this node in a slightly sneaky way - the mean of the Gaussian noise latent gets randomized with a uniform draw between -0.2 and 0.2, so the noise itself drifts run to run. That nesting is the actual power move: a randomizer feeding another randomizer.

    Fitting it into a workflow

    Wire the FLOAT output into anything that accepts a float - cfg, denoise, LoRA strength, a KSampler step count. Randomize the seed each run and queue a batch. One discipline to keep: if you're doing this to learn anything from comparing outputs, use a converging sampler (Euler, DPM++ 2M, DDIM). On ancestral samplers the added per-step noise blurs the difference between "this parameter changed" and "the sampler wandered," so your experiment stops telling you anything.

    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 "Latent Tools" and install, then restart ComfyUI. Manual path:

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

    Then restart ComfyUI; the node lives under the LatentTools category. The only Python dependency is lovely-tensors, no model downloads. It's a niche, single-author pack - fine for a tool like this, just don't expect it in every workflow you download.

    CategoryLatentTools

    Inputs (3)

    NameTypeDefaultDescription
    min_valueFLOAT0.0000-1000000–1000000
    max_valueFLOAT1.0000-1000000–1000000
    seedINT00–18446744073709550000

    Outputs (3)

    NameTypeDescription
    FLOATFLOAT
    INTINT
    STRINGSTRING