Nodes/WAS Node Suite v3/Random Number
ComfyUI Node Runs on cloud

Random Number

A general-purpose dice roll for your graph

By WASasquatch·Created 3 years ago·Updated 4 days ago· 1,832
Random Number
    • NUMBER
    • FLOAT
    • INT
    number_type
    minimum0.00
    maximum0.00
    seed0

    This one's actually well documented in WAS's own README, more so than most of its neighbors, and it's worth quoting directly because the node does more than its name suggests. Set a min and max, and Random Number gives you, per the pack's own description: a random integer between min and max (inclusive, uniformly distributed), a random float between min and max (also inclusive and uniform), a random 0-or-1 value that reads as a boolean if you take it off the int output, and a random shuffled list of the integers in that range, returned as a string - the README's own example: with min=0 and max=3, a possible result is the string '3,1,2,0'.

    Why it's not "just" the sampler's seed

    It's tempting to think ComfyUI's noise seed already covers randomness and stop there, but the seed only randomizes generation - the actual diffusion noise. Random Number is a general-purpose random value you can wire anywhere a NUMBER or a shuffled sequence is useful: randomizing a crop offset between runs, picking among several LoRA strengths without hardcoding one, driving a random choice of prompt fragment, or generating a shuffled batch order via the list output. It's decoupled from sampling entirely - you can randomize structure and layout decisions in your graph independent of whatever the KSampler's own seed is doing.

    The inputs and outputs that matter

    min and max define the range everything else draws from. From there the node hands back several flavors at once, per the README: an integer roll, a float roll, a 0/1 value usable as a boolean, and - distinct from the other three - a shuffled string list of every integer in the range, not just a single draw.

    Worth knowing about too: WAS also ships a separate True Random.org Number Generator node that pulls genuinely non-deterministic entropy from atmospheric noise via random.org's API (it needs an API key from your random.org account). Random Number, by contrast, is the fast, local, no-network option - reach for random.org's node specifically if you need cryptographic-grade randomness rather than a standard pseudo-random draw, which is what the vast majority of graphs actually want.

    Installing it

    ComfyUI Manager: search "WAS Node Suite," install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/WASasquatch/was-node-suite-comfyui
    

    install requirements.txt against your ComfyUI Python, restart. No model download, no heavy dependency.

    Common issues & troubleshooting

    Getting a different value every queue when I wanted it fixed. That's expected - it's a random draw, re-rolled on execution. If you need a value to stay put while you iterate on the rest of the graph, generate it once, note the result, and swap in a Constant Number with that fixed value instead of leaving the random node wired in.

    Wired the wrong output into the wrong slot. The node hands back several types at once (int, float, boolean-ish, string list) - plugging the shuffled-list string into something expecting a plain integer, or vice versa, is a type mismatch, not a bug. Double-check which specific output you dragged the wire from.

    Whole pack fails to import. WAS Node Suite has been unmaintained since the author marked it retired in December 2023; the recurring failure is the entire suite throwing "Import Failed" after a ComfyUI update from a pinned dependency clash. Reinstall requirements.txt against the correct, embedded Python interpreter and restart.

    CategoryWAS Suite/Number

    Inputs (4)

    NameTypeDefaultDescription
    number_typeCOMBOWhat kind of number to draw. `integer` picks a whole number, both bounds included, cutting any fraction off the bounds first. `float` picks a decimal anywhere between them. `bool` ignores both bounds and picks a decimal from 0 up to 1, which the INT output rounds to 0 or 1 for a coin flip.
    minimumFLOAT0.00-18446744073709550000–18446744073709550000The lowest value that can come out, itself included. Ignored in `bool` mode. Both bounds default to 0, which draws 0 every time until they are changed.
    maximumFLOAT0.00-18446744073709550000–18446744073709550000The highest value that can come out, itself included. Ignored in `bool` mode, and in `integer` mode a maximum below minimum stops with an error.
    seedINT00–18446744073709550000Seed for the draw. The same seed always gives the same number; change it for a different one. Only this node's draw is affected, sampling noise elsewhere in the prompt is left alone. Any whole number; `0` is as good a seed as any.

    Outputs (3)

    NameTypeDescription
    NUMBERNUMBERThe drawn value: whole in `integer` mode, decimal in `float` and `bool` mode.
    FLOATFLOATThe same value as a decimal.
    INTINTThe same value rounded to the nearest whole number, which is where the 0 or 1 of `bool` mode comes from.