ComfyUI Node

Random_Sampler

A KSampler that changes its own steps, CFG and denoise

By lilly1987·Created 3 years ago·Updated 2 years ago· 57
Random_Sampler
  • model
  • positive
  • negative
  • LATENT
  • LATENT
sampler_name
scheduler
seed0
steps_min20
steps_max30
cfg_min5.0
cfg_max9.0
denoise_min0.50
denoise_max1.00

Random_Sampler is a KSampler that refuses to commit. It takes everything a normal sampler does - model, conditioning, latent, sampler, scheduler, seed - but instead of steps, cfg and denoise, you give it ranges, and every run it rolls fresh values inside them. Same prompt, same seed, and the generation conditions themselves shift each time.

If you're deep in the "just explore the space" mindset - batch out sixty images and curate - this is actually a smart division of labor. You keep the prompt fixed, randomize the sampling parameters, and see how much of your image quality is steps, how much is CFG, and how much is the prompt itself. The alternative is manual sweeps one node at a time, which is soul-crushing. The one genuinely useful pattern is coupling this with a wildcard encoder from the same pack: random prompt and random sampler settings in one queue, which is about as close to "press button, get surprised" as ComfyUI got in 2023.

Inputs

The sampler-side inputs you'll actually touch:

  • steps_min / steps_max (default 20–30) - integer steps rolled in range.
  • cfg_min / cfg_max (default 5–9) - CFG rolled in half-step increments.
  • denoise_min / denoise_max (default 0.5–1.0) - denoise strength rolled as a float.

Plus model, positive, negative, LATENT, sampler_name (full KSampler list), scheduler (all nine standard schedules) and seed. The output is a LATENT - same as the stock KSampler - so it slots into any existing graph that expects sampler output.

Two source-level notes. The seed input is passed to common_ksampler but never seeds the parameter rolls, so the rolls are random regardless of seed - fine for exploration, useless for reproducibility. And the CFG roll has a subtle quirk: it draws an integer, then halves it, so you can get half-step values like 6.5.

Install and when to skip it

Clone and restart; ComfyUI Manager finds it by searching "Lilly":

cd ComfyUI/custom_nodes
git clone https://github.com/lilly1987/ComfyUI_node_Lilly

Restart after cloning. No model downloads; rich/chardet auto-install on first load.

When to skip it: modern model families have broken the old "CFG 7 is default" assumption - on guidance-distilled models the correct CFG is 1 and randomizing it upward just burns images. This node is built for the SD 1.5 / SDXL DDPM world where CFG 4–9 meant something. For those models it's a fun and honest exploration tool; for 2026 models, set your ranges to their fixed correct values and let the wildcards do the randomizing. The pack is unmaintained, so expect no updates.

Categorysampling

Inputs (13)

NameTypeDefaultDescription
modelMODEL
positiveCONDITIONING
negativeCONDITIONING
LATENTLATENT
sampler_nameCOMBO34 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +28
schedulerCOMBO9 options: normal, karras, exponential, sgm_uniform, simple, ddim_uniform, +3
seedINT00–18446744073709550000
steps_minINT201–10000
steps_maxINT301–10000
cfg_minFLOAT5.00–100
cfg_maxFLOAT9.00–100
denoise_minFLOAT0.500.01–1
denoise_maxFLOAT1.000.01–1

Outputs (1)

NameTypeDescription
LATENTLATENT