Random seed doesn't work in comfyui

The random seed of comfyui is not working. The random seed is set in the json file, but when I run comfyui in n8n, the same seed is used to generate images every time. Has anyone encountered the same problem?

Hey Danny, welcome to the community mate

About the question you asked, I am guessing the problem could be in the JSON. Sometimes n8n will cache a file in memory, so even if you edit your JSON, it never actually reloads. Try adding a “Read Binary File” or “Read JSON File” node just before your ComfyUI node, pointing at your seed-config file. That way you guarantee n8n pulls in whatever seed you’ve set each time. Make sure the file path is correct and that the node’s “Binary Property” (or “Data Property”) matches what your ComfyUI node expects.

You could also try passing the seed dynamically. Drop in a small “Function” node (or “Set” node) before ComfyUI and generate or pull in a random seed there. Then map that field directly into the ComfyUI parameters in n8n. Even if the ComfyUI node’s JSON loader is wonky, you’ll be explicitly telling it “seed = this value” every time.

Hope this helps

"I’ve actually run into a similar issue before! What I usually do is set up a code node in the previous step to generate a random number. Something like this:

$input.item.json.myNraddomSeed={ seed: new Date().getTime() };

Then, in ComfyUI Node, you just replace the “seed” value with that."

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.