Seed Generator 🧅
The fix for KSampler's 'random seed updated itself' problem
- SEED
Here's the annoyance that made this node exist: KSampler lets you set its seed to "random," but it rolls a new one every time the workflow runs, and by the time you've looked at the output the number is gone. You get a great image and can't reproduce it without digging through the console. This node fixes that with a single dropdown, and it's the kind of small thing you stop noticing until you're doing prompt/seed sweeps and suddenly your life is easier.
What it does
Seed Generator outputs an integer you wire into a KSampler's seed input. Its one input, generation_mode, has exactly two options:
random- a new seed is generated each time the workflow executes. Unlike KSampler's built-in random, the value is produced at execution time and printed to your console (NegiTools_SeedGenerator: provided seed value = ...), so you can read it back.keep_previous- the node holds onto the last seed it generated and keeps returning it. Flip the dropdown fromrandomtokeep_previousand the seed stays frozen, run after run.
That's the whole trick. Set it to random, iterate until you hit something good, flip to keep_previous, and the winning seed is locked in. You never have to copy a number into a field.
Why it beats the built-in random
The mechanism matters here. KSampler's "random" is updated after execution, so the value shown isn't necessarily the one that ran. This node generates the seed at execution time and prints it, so what you see is what ran. It's also a plain random.randint behind the scenes, so the values are normal 64-bit ints that work with any sampler input. There's a small price: because the seed is generated at run time, ComfyUI's caching can't precompute the node's output, which is why the node implements IS_CHANGED to force a re-execution - don't be surprised if it re-triggers the graph each run in a way that's actually the intended behavior.
Where it fits
Wire SEED into any KSampler, and optionally pair it with Image Properties or Latent Properties from the same pack if you're building a re-runnable workflow that records its own settings. It's genuinely useful for the discipline the community keeps preaching - lock the seed, change one variable, compare. This node makes that less tedious because you can go back to "random" any time without losing your place.
Installing it
Part of ComfyUI-NegiTools. Install via ComfyUI Manager (search "ComfyUI-NegiTools") or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/natto-maki/ComfyUI-NegiTools
pip install -r ComfyUI-NegiTools/requirements.txt
then restart. No API key, no downloads, no runtime cloning - it's pure Python. The pack's other utilities and the OpenAI nodes share that single requirements.txt, so the install cost is one-time.
The honest caveat
This is a solve-a-nicety node, not a superpower. If you already pin your seeds manually or your workflow is one-shot, you may never need it. But if you do batch sweeps or keep losing good seeds to the void, it earns its place in about two minutes of use. Just remember: the printed seed is the ground truth - if you're reproducing a result on a different machine or a later ComfyUI version, the seed alone won't guarantee identical output if your sampler settings drifted.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| generation_mode | COMBO | 2 options: random, keep_previous |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| SEED | INT | — |