ComfyUI Node

Seed

A seed that can think for itself

By teward·Created 2 years ago·Updated 2 years ago· 9
Seed
    • seed
    seed-1

    The Seed node does the obvious thing - give you an integer to plug into KSampler - with one genuinely useful twist: set it to -1 and it hands you a fresh random seed on every run. Roll the dice or pin the number, same node.

    You'd think that's trivial. The interesting part is how it rolls the dice, because the pack's author went out of his way for it. ComfyUI's global random state gets monkeyed with by some extensions - other custom packs reseed it, which quietly changes the behavior of anything downstream that relies on it. This node keeps its own private random state, seeded once at import, and draws from that. Your "random" stays random regardless of what else is loaded. It's a small defensive detail, and the kind of thing you only appreciate after it saves you a confusing afternoon.

    How it works

    The seed input is an INT that defaults to -1 and runs from -1 up to 18446744073709551615 - the full 64-bit ceiling. If you set a real number, the node echoes it back unchanged. If it's -1, the node generates a random value from its private generator and returns that instead. Either way you get one seed output, typed INT, ready for KSampler's seed and Save Image's seed_value.

    Worth noting: the returned random value is a new number each execution, not -1. So if you're logging seeds for reproducibility, read the value off the wire or out of the image metadata - Save Image will happily stamp it in for you.

    Inputs and outputs

    • seed - required INT, default -1 (random), up to 64-bit max.
    • seed output - the resolved INT, wire into KSampler seed and Save Image seed_value.

    The honest take

    If you already have a favorite seed widget from another pack, you don't need this one. What it adds over the stock KSampler seed field is that the value becomes data: it travels on a wire and lands in metadata, so your outputs carry their own provenance. And the -1 behavior is the right default for a tool where most of us don't want to think about seeds most of the time. Set -1, iterate freely, and only pin a seed when a result is worth revisiting.

    Install

    ComfyUI Manager → search ComfyUI-Helper-Nodes, install, restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/teward/ComfyUI-Helper-Nodes
    

    Then restart. No models, no heavy deps - piexif and whratio beyond ComfyUI's built-ins, both installed automatically by Manager.

    Troubleshooting

    The most common confusion is people expecting -1 to flow through as the actual seed. It doesn't - it's an instruction, and the node replaces it. If you want a repeatable run, type an explicit number. If two runs at -1 gave you the same image, check that you're actually re-executing the graph rather than re-running from a cached result.

    CategoryComfyUI-Helper-Nodes/sampler

    Inputs (1)

    NameTypeDefaultDescription
    seedINT-1-1–18446744073709550000

    Outputs (1)

    NameTypeDescription
    seedINT