Nodes/GENKAI Nodes/Seed Slots (genkai)
ComfyUI Node

Seed Slots (genkai)

A slot machine that also fixes ComfyUI's seed trap

By GENKAIx·Created about a month ago·Updated 21 days ago· 9
Seed Slots (genkai)
    • seed
    ◄seed0►
    ◄lock_seedfalse►

    The most reliable beginner injury in ComfyUI isn't a memory error. It's finding a great image on a random seed, flipping control_after_generate to fixed to keep it, and discovering you've already lost it - because the control fires after the run, so the number in the box was the next seed, not the one that made the thing you're looking at.

    Seed Slots is a slot machine. It's also a seed node that sidesteps that trap by being explicit about when it draws, and it keeps the last 50 results so you can go back and grab one.

    How it works

    Two inputs, one output. seed is an INT from 0 to 9,999,999,999 and lock_seed is a boolean; the output is seed, an INT you wire into your sampler's seed (right-click the sampler seed field → Convert widget to input first).

    Behaviour, straight from the source: when the lock is off, each execution draws a fresh number with secrets.randbelow. When the lock is on, it reuses the displayed number and nothing is drawn. Simple, and the honesty is in what comes next.

    The node implements IS_CHANGED, and it returns seed when locked and float("nan") when unlocked. That NaN is ComfyUI's standard always-dirty idiom - NaN != NaN, so the cache can never consider the node unchanged, so it re-executes on every run. Which is exactly what you want from a random seed generator and is also worth knowing, because a node that's always dirty takes everything behind it down with it. Unlocked, this node forces a fresh pass through the whole downstream graph every queue. Locked, it goes quiet and behaves.

    control_after_generate is disabled on the widget on purpose, so you don't get two mechanisms fighting over the same number.

    It also writes the executed seed into the node's metadata as it runs, available to savers that read EXTRA_PNGINFO - so a save node downstream can record which spin produced the file. That's the feature that makes the toy actually useful: your outputs stay traceable.

    The inputs and outputs that matter

    • seed - the widget you don't have to set. Manual entry works and locks the number when you do it.
    • lock_seed - the only switch that matters. Off: new draw every run. On: reproducible, cached, boring in the good way.
    • seed (output, INT) - into the sampler.

    Around that there's a UI worth ten seconds of your time: SPIN and the lever draw a number without queuing a workflow; RECENT SEEDS holds the last 50 draws with their timestamps and scores, and clicking one restores and locks it. That's the recovery path for the whole burn-you-once seed problem.

    The scoring - adjacent repeats, 7s, straights, mirrors, twin halves, a total score - is pure decoration. The README says so itself: scores don't improve generation quality. The confetti isn't a quality signal either, tempting as that is to believe.

    How to install it

    cd ComfyUI/custom_nodes
    git clone https://github.com/GENKAIx/Genkai-ComfyUI-Nodes
    

    Or ComfyUI Manager → Genkai-ComfyUI-Nodes. Restart, Ctrl+F5 - there's a JS frontend here, so the hard refresh matters. Category: GENKAI → Seeds. No models, no dependencies; the file imports secrets, datetime and uuid and that's the list.

    If you want a smoke test with no model loaded, the pack ships an example that wires Seed Slots into a text preview.

    Common issues

    Everything is re-generating every queue and the run is slow. lock_seed is off, which means IS_CHANGED returns NaN, which means the cache is off for the node and its downstream. That's the design, not a bug - but turn the lock on when you're iterating on something else in the workflow.

    I pasted a seed from elsewhere and it changed. The widget caps at 9,999,999,999. A 64-bit seed copied out of a KSampler won't survive the trip intact.

    The animation didn't play on a cached run. Cached runs skip replaying it - nothing in the node delays execution, the UI just doesn't re-fire events it already fired.

    Seed/lock/history gone after reopening. They're stored in the workflow, not in a global config, so an unsaved workflow loses its spin history. That's true of the score too; save the workflow if you care about the running total.

    CategoryGENKAI/Seeds

    Inputs (2)

    NameTypeDefaultDescription
    seedINT00–9999999999—
    lock_seedBOOLEANfalse—

    Outputs (1)

    NameTypeDescription
    seedINT—