Nodes/ComfyUI Inspire Pack/Random Generator for List (Inspire)
ComfyUI Node Runs on cloud

Random Generator for List (Inspire)

A fresh random value for every item in a list

By ltdrdata·Created 3 years ago·Updated 9 months ago· 805
Random Generator for List (Inspire)
  • signal
  • signal
  • random_value
seed0

This one solves a genuinely annoying ComfyUI quirk. When you process a list - say a batch of images loaded as a list, where the graph runs once per item - a normal seed/random node produces the same value every iteration, because it only evaluates once. So if you wanted a different random seed per image in the list, you couldn't easily get it. Random Generator for List fixes that: connect your list to its signal input and it hands back a different random value for each item in the list.

The typical use is per-item variation across a list run: a unique seed per image so each gets its own noise, a random parameter that differs per iteration, or any spot where "one value for the whole list" is exactly wrong and you need "one value per element." It's small, but if you've fought this you know how much it helps.

How it works

ComfyUI's list mechanism runs a sub-graph once for each item. This node is list-aware: it walks the list flowing through signal and emits a distinct random integer per element, seeded by seed for reproducibility. The signal input is a wildcard type - it doesn't care what your list actually contains (images, latents, strings); it just uses the list to know how many values to generate and to preserve the per-item execution. The same seed gives the same sequence of randoms every run, so it's repeatable, not chaos.

The inputs and outputs that matter

  • signal (type *) - the list you want one random value per item for. This is the trigger; wire your list output into it. The node passes it straight through so it isn't consumed.
  • seed (INT) - the base seed for the random sequence. Fixed seed, reproducible per-item randoms; change it for a new set.

Outputs:

  • signal (type *) - pass-through of your list, so the node splices inline without breaking the chain.
  • random_value (INT) - the per-item random. This is the output you route to wherever you needed a varying value (a seed input, for instance).

How to install it

ComfyUI Manager: search ComfyUI Inspire Pack, install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Inspire-Pack

then restart. It's a Dr.Lt.Data pack (ComfyUI-Manager, Impact Pack).

Common issues & troubleshooting

I'm getting the same value every time. Two possibilities. Either you're not actually running a list (a single item or a batched tensor isn't a list, and there's only one iteration to randomize), or you're reading a fixed seed and expecting run-to-run variety - the seed makes it reproducible on purpose. For different values across whole runs, change the seed (or drive it from a seed-control node).

Nothing downstream varies. Make sure you're routing the random_value output to the thing that needs to differ per item, and that that consumer is inside the same list execution. If the consumer runs once outside the list, it can only take one value.

It's not iterating per item. The list has to actually reach this node through signal. If upstream collapsed your list into a batch (a single IMAGE tensor rather than an image list), there's no list to iterate - use a list loader (like Inspire's Load Image List From Dir) so the data stays a list.

Order feels off. Keep the signal pass-through in the chain so this node sits on the list's execution path rather than dangling off to the side - that's what keeps the per-item timing correct.

CategoryInspirePack/Util

Inputs (2)

NameTypeDefaultDescription
signal*
seedINT00–18446744073709550000

Outputs (2)

NameTypeDescription
signal*
random_valueINT