Nodes/petty-paint-comfyui-node/PPGenerateRandomFloat
ComfyUI Node

PPGenerateRandomFloat

A random float when you want variety, not reproducibility

By mephisto83·Created 2 years ago·Updated 2 years ago· 3
PPGenerateRandomFloat
    • random_float
    min_value0.00
    max_value1.00

    Sometimes you want the sampler to not be so deterministic. Feed a fixed CFG or denoise value into every run and every run behaves the same; feed it a random float inside a sane range and you get variety for free. PPGenerateRandomFloat is the pack's tool for that: a min and a max, and out comes a float rolled uniformly between them. It's the sort of node that looks trivial and mostly is - the value is in where you put it.

    How it works

    Two FLOAT inputs, min_value (default 0.0) and max_value (default 1.0), and the node calls random.uniform(min, max) - a uniform draw, so every value in the range is equally likely, and floats land anywhere in between, not just nice round steps. The result comes out the random_float output, typed FLOAT, ready to plug into anything that takes a float: CFG, denoise, LoRA strength, upscale amount, whatever.

    The important behavioral detail is in the code: the node overrides IS_CHANGED to always return True. That means ComfyUI treats it as changed every single execution, so you get a fresh random value on every queue run - no caching, no "same value until I touch a widget" surprises. It also means it re-executes anything downstream that depends on it, so be ready for that.

    The flip side of always-fresh

    No seed input. That's not an oversight - it's the design. This node will never reproduce a value, which makes it the wrong tool for anything where you need to recreate a run (save the value somewhere else if you think you'll want it back). It's also worth knowing that because it always counts as changed, it'll force re-execution of downstream nodes even when nothing else moved. That's usually the point - you want the sampler to re-roll - but it's a thing to keep in mind if you wire it into a long chain and wonder why everything re-runs every time.

    Installing it

    It ships in the petty-paint pack. Install once via ComfyUI Manager (search "Petty Paint" or petty-paint-comfyui-node), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/mephisto83/petty-paint-comfyui-node
    

    then restart. No model downloads; the pack's pinned Flask requirement isn't imported by the current source, so nothing heavy installs alongside it.

    Where you'd actually use it

    A common trick in the petty-paint loop is randomizing CFG or denoise per frame so a run of images doesn't look monotonous, or rolling a fresh seed-range so each queue gives you a different starting point. If you need an integer roll instead - seed values, step counts - the sibling PPGenerateRandomNumber does the same job with INT bounds. Keep this one for the float-shaped inputs and it's a genuinely handy little node.

    CategoryCustomNodes

    Inputs (2)

    NameTypeDefaultDescription
    min_valueFLOAT0.00
    max_valueFLOAT1.00

    Outputs (1)

    NameTypeDescription
    random_floatFLOAT