ComfyUI Node

πŸ§ͺ Laboratory

A number generator with a memory, for when randomness has to behave

By alt-key-projectΒ·Created 3 years agoΒ·Updated 2 years agoΒ· 114
πŸ§ͺ Laboratory
  • frame_counter
  • FLOAT
  • INT
  • log_entry
β—„keyRandom value 804654β–Ί
β—„seed0β–Ί
β—„renew_policyβ–Ύβ–Ί
β—„min_value0.00β–Ί
β—„max_value1.00β–Ί
β—„modeβ–Ύβ–Ί
β—„step_size0.10β–Ί

Most random-value nodes in ComfyUI are dumb in a specific way: they give you a number and forget everything. Laboratory [Dream] is the opposite. The README calls it a "super-charged number generator for experimenting," and the supercharge is memory - it can produce a random value once and then reuse that exact value for the rest of the run, or roll a new one every single frame, and it remembers what it produced even across runs of the graph. That makes it genuinely useful for animation, where you often want a parameter that's random but stable, or stable-but-varying on a schedule.

Here's the mechanism. You give the node a key (a string that names this particular value), a seed, a min_value/max_value range, and a mode. Every time it runs it checks its state store: if this is the first frame, or renew_policy is "every frame," it generates a new value with that seed and stores it under the key. Otherwise it returns the stored value. The mode decides how random: random uniform is a flat pick, random bell averages three uniform draws so values cluster around the middle, ladder steps up by step_size (wrapping around), and random walk takes a small step up or down each time. Because the state is persisted to disk, a "first frame" value survives between runs - same graph, same key, same number, which is great when you want reproducibility without hardcoding.

The inputs that matter

  • frame_counter - required; it decides what "first frame" and "every frame" mean.
  • key - the identity of this value. Change it and you get a fresh, independent value. The default is a random name, so two Laboratory nodes default to unrelated values.
  • mode - random uniform / random bell / ladder / random walk. The one beginners underestimate is ladder: it's not random at all, it's a counter that climbs by step_size and wraps.
  • renew_policy - "every frame" for a constantly changing value, "first frame" for one random value held steady.
  • step_size - only used by ladder and random walk (optional).

It outputs FLOAT, INT, and a log_entry (so you can tee it straight into the pack's logging chain).

Installing it

Install via ComfyUI Manager - search "Dream Project Animation Nodes" - or clone:

cd ComfyUI/custom_nodes
git clone https://github.com/alt-key-project/comfyui-dream-project.git
cd comfyui-dream-project
pip install -r requirements.txt

Restart ComfyUI. The pack's numpy<2.0 pin is the only install gotcha worth remembering.

Common issues

The one thing that trips people is expecting the state to reset. Because Laboratory persists its per-key value to disk, a value you think is fresh may be the same one from a previous run - that's a feature, but only when you understand it. Change the key or the seed to force a new value. And if you want truly different values from two instances, change the default key (it includes a random number, but that default is baked in at node creation). Also note the pack is declared unmaintained in its README - fine for this node, it's stable and small.

Category✨ Dream/πŸ›  utils

Inputs (8)

NameTypeDefaultDescription
frame_counterFRAME_COUNTERβ€”
keySTRINGRandom value 804654β€”
seedINT00–18446744073709550000β€”
renew_policyCOMBO2 options: every frame, first frame
min_valueFLOAT0.00β€”
max_valueFLOAT1.00β€”
modeCOMBO4 options: random uniform, random bell, ladder, random walk
step_sizeoptFLOAT0.10β€”

Outputs (3)

NameTypeDescription
FLOATFLOATβ€”
INTINTβ€”
log_entryLOG_ENTRYβ€”