Nodes/MD Nodes/MD: Advanced Seed Generator
ComfyUI Node

MD: Advanced Seed Generator

A seed node that actually remembers what it did

By MDMAchine·Created about a year ago·Updated 3 months ago· 15
MD: Advanced Seed Generator
    • seed
    • seed_str
    seed0
    actionFixed
    seed_offset0
    debug_mode0 - Silent

    ComfyUI's built-in seed widget has a quirk that bites everyone eventually: it only changes when ComfyUI wants it to, and the native "randomize" behavior lives inside the widget rather than the graph. MD_AdvancedSeedGenerator is a proper graph-level seed source with five modes, an offset, and an output that tells you the exact seed it used.

    The design goal is spelled out in the source: everything stays inside JavaScript's safe integer range (0 to 9,007,199,254,740,991), so the seed you see is the seed that ran - no precision drift.

    The inputs

    • seed - the base. 0 is fine if you're randomizing; your favorite seed if you're iterating.
    • action - the mode, and the part that makes this node more than a widget wrapper:
      • Fixed - output is seed + offset. Fully reproducible.
      • Randomize - crypto-random number. The tooltip's recommendation for exploration.
      • Increment / Decrement - seed + offset ± 1, wrapping. Step through variations without touching the base.
      • System Time - the current nanosecond timestamp. A near-guaranteed-unique seed every run, useful for "never the same thing twice" batch runs.
    • seed_offset - add or subtract without editing the base. The tooltip's pattern is the good one: keep the base fixed at 100 and sweep offset 1, 2, 3 for controlled variation. Applied in every mode except System Time.

    Outputs

    seed (INT - wire into your KSampler) and seed_str (STRING - same value as text, for embedding in metadata or filenames so you can reproduce a render later from its saved info).

    One subtle behavior worth knowing: Randomize and System Time force the node to re-run every queue (the source makes IS_CHANGED return a fresh value each time), while Fixed/Increment/Decrement only execute when inputs change. That's the caching behavior you want - random modes must never be cached, deterministic ones should be.

    Installing it

    Part of MD Nodes (MDMAchine/ComfyUI_MD_Nodes). ComfyUI Manager → search MD_Nodes → Install, restart, or:

    cd path/to/ComfyUI/custom_nodes
    git clone https://github.com/MDMAchine/ComfyUI_MD_Nodes.git
    cd ComfyUI_MD_Nodes
    pip install -r requirements.txt
    

    Restart ComfyUI. Python 3.10+, GPL v3, pure Python.

    Common issues

    The thing people trip on is expecting Increment to step between runs the way widget seeds do. It doesn't carry state - it computes deterministically from seed + offset + 1 on the inputs you give it. If you want a sequence of different seeds across a batch, sweep the offset from outside (a counter node, an LFO, another graph source). Also note that the native widget's "control after generate" is deliberately disabled on the seed input, so the randomization happens through the action menu, not the little shuffle arrow you might be used to.

    CategoryMD_Nodes/Utility

    Inputs (4)

    NameTypeDefaultDescription
    seedINT00–9007199254740991BASE SEED • Purpose: The starting point for seed generation. • Range: 0 to 9,007,199,254,740,991 (JS-Safe). ⭐ Recommended: Keep at 0 or your favorite seed, use 'Fixed' mode to stick to it.
    actionCOMBOFixedGENERATION ACTION • Purpose: Controls how the final seed is calculated. • Fixed: Output = Seed + Offset • Randomize: Output = Crypto-Random Number • Increment: Output = Seed + Offset + 1 (Wraps) • Decrement: Output = Seed + Offset - 1 (Wraps) • System Time: Output = Current Nanosecond Timestamp ⭐ Recommended: 'Fixed' for reproducibility, 'Randomize' for exploration.
    seed_offsetINT0-9007199254740991–9007199254740991SEED OFFSET • Purpose: Add/Subtract from the base seed without changing the base input. • Note: Applied in all modes except 'System Time'. ⭐ Recommended: Use for variations (e.g. set Base to 100, Offset to 1, 2, 3...)
    debug_modeCOMBO0 - SilentLOGGING VERBOSITY • Purpose: Controls console output detail level. • Options: 0 (Production), 1 (Analytics Report), 2 (Full trace). ⭐ Recommended: 1 - Info when optimizing workflows.

    Outputs (2)

    NameTypeDescription
    seedINT
    seed_strSTRING