Nodes/comfyui-AGSoft/🎲 AGSoft Loop Random Seed
ComfyUI Node

🎲 AGSoft Loop Random Seed

Five unique seeds out of one node — stop re-rolling by hand

By Art-xmaster·Created 12 months ago·Updated about 8 hours ago· 23
🎲 AGSoft Loop Random Seed
    • INT
    count5
    min_seed0
    max_seed4294967295
    seed_for_random0

    If you've ever sat in ComfyUI typing seed after seed into a KSampler to find a good one, this node exists to end that. AGSoft Loop Random Seed hands you a whole list of random seeds at once - guaranteed unique, no duplicates, no spreadsheet - so you can farm a batch of variations in a single run.

    It comes from the AGSoft pack, the big Russian-authored grab-bag of ~80 utility nodes. There's a family of "Loop" nodes here (Integer, Float, Texts, Random Seed) that all do the same trick: produce a list of values for batch processing. This one produces seeds, and it's the one you'll actually keep wired up.

    How it works

    The mechanism is refreshingly honest. It seeds Python's own random.Random with your seed_for_random, then calls .sample() on the whole range of allowed seed values - sampling without replacement. That's the whole "unique" guarantee: you physically cannot get the same seed twice in one list. And because the random generator is seeded, fixing seed_for_random gives you the identical list every run. Reproducibility for free.

    If you ask for more seeds than the range can hold, it just errors out - min_seed > max_seed or count bigger than the range both throw a clear ValueError instead of silently wrapping around. Good behavior.

    The inputs that matter

    Only four, and you'll touch two:

    • count - how many seeds (1–100). This is the one you set for a batch.
    • min_seed / max_seed - the range. Defaults are 0 to 4294967295, which is plenty; narrow it if you want to stay in a known-good region.
    • seed_for_random - the seed for the generator itself. Default 0; bump it when you want a different list.

    The output is a single INT list. Wire it into anything that eats a list of numbers - an image batch loop, a Prompt Switch driving a ForEach-style workflow, or a node that sets seeds per batch item. If you're looping over seeds manually, this replaces a whole block of plumbing.

    Installing it

    Same as every node in this pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Art-xmaster/comfyui-AGSoft
    

    Restart ComfyUI. Or use ComfyUI Manager and search "comfyui-AGSoft". No model downloads, no heavy deps - the pack's requirements are just numpy, opencv-python and translators (for its translate node); this one is pure Python stdlib.

    Common issues

    The only real failure mode is asking for too much: count larger than the seed range throws, and so does min_seed > max_seed. If you're using a tiny custom range, do the arithmetic before you queue. Otherwise it's about as trouble-free as a node gets - and the fixed-seed discipline the community preaches ("change one variable at a time with a fixed seed") is exactly what this makes easy at batch scale.

    CategoryAGSoft/Utility

    Inputs (4)

    NameTypeDefaultDescription
    countINT51–100Number of random seeds to generate. Example: count=3 → [42, 1024, 999] Сколько случайных seed'ов сгенерировать. Пример: count=3 → [42, 1024, 999]
    min_seedINT00–18446744073709550000Minimum possible seed value. Минимальное значение seed.
    max_seedINT42949672950–18446744073709550000Maximum possible seed value. Максимальное значение seed.
    seed_for_randomINT00–18446744073709550000Seed for the random generator itself (for reproducibility). Seed для генератора случайных чисел (для воспроизводимости).

    Outputs (1)

    NameTypeDescription
    INTINT