Nodes/Dream Painter/πŸ”ƒ Random Number Generator
ComfyUI Node

πŸ”ƒ Random Number Generator

A seeded random number you can actually reproduce

By alt-key-projectΒ·Created 2 years agoΒ·Updated 2 years agoΒ· 2
πŸ”ƒ Random Number Generator
    • random_float
    • random_int
    β—„seed0β–Ί
    β—„min_value0.00β–Ί
    β—„max_value1.00β–Ί
    β—„distributionβ–Ύβ–Ί

    Most of a Dream Painter workflow is rigidly deterministic: same shapes, same viewport, same render, same bitmap. Random Number Generator is the one place you inject chaos - and it does it in a way you can actually control, because it's seeded. Set the seed, get a number; change the seed, get a different one. Same seed later, same number again. That reproducibility is the whole point, and it's what makes this node useful instead of annoying.

    Where it fits: the pack's rays_of_color example drops several of these into a graph and feeds the outputs into shape parameters - ray origins, sizes, colors. Instead of hand-tuning twelve numbers to get variety, you randomize them and then vary one seed to get an endless family of variations. If you've used the seed system in ComfyUI's samplers, this is the same idea applied to your parameters, not just the noise.

    How it works

    It's a thin wrapper around Python's random.Random(seed), which is a deterministic PRNG - the same seed always produces the same sequence, regardless of platform or run. You pick:

    • seed - any integer; it defines the entire sequence.
    • min_value / max_value - the range the output lands in (defaults 0 to 1).
    • distribution - uniform gives a flat random draw in the range; normal is meant to cluster around the middle.

    The honest caveat: the "normal" distribution here is a cheap approximation - it averages five uniform draws, not a true Gaussian. It's fine for "mostly middle, occasionally extreme" variety; it is not a statistically rigorous bell curve. For real Gaussian randomness you'd want an actual stats library elsewhere.

    Inputs and outputs

    • seed, min_value, max_value, distribution (above).

    Outputs:

    • random_float (FLOAT) - the random value.
    • random_int (INT) - the same value rounded to an integer.

    Both come out of one run, so you can wire the float into a size or position parameter and the int into something that wants a whole number (like a copies count) and they'll be consistent with each other.

    Installing

    From the Dream Painter pack (comfyui-dream-painter, alt-key-project). ComfyUI Manager β†’ Install Custom Nodes β†’ search Dream Painter β†’ install β†’ restart. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/alt-key-project/comfyui-dream-painter
    cd comfyui-dream-painter
    pip install -r requirements.txt
    

    No models, no downloads.

    Common issues

    The seed trap: people hook the seed to a fixed widget, get one result, and wonder why nothing varies. Randomization only happens when you change the seed. Wire the seed to a changing source (a random seed node, a counter, the current time) if you want a new value every run - or keep it fixed when you want a stable, reproducible composition. And remember random_int is the rounded float, so if you need integers in a specific step (like every 5), you'll want to do that rounding downstream yourself.

    CategoryπŸ–Œ DPaint/🧰 utility

    Inputs (4)

    NameTypeDefaultDescription
    seedINT00–18446744073709550000β€”
    min_valueFLOAT0.00β€”
    max_valueFLOAT1.00β€”
    distributionCOMBO2 options: uniform, normal

    Outputs (2)

    NameTypeDescription
    random_floatFLOATβ€”
    random_intINTβ€”