ComfyUI Node

prompt - random

Turn a tag list into a batch of prompt variations

By YMC-GitHub·Created 3 years ago·Updated about a year ago· 20
prompt - random
  • seed
  • STRING
max_count9
mutable_promptSwing Slide Climbing frame Sandbox See-saw Merry-go-round Jungle gym Trampoline Monkey bars Rocking horse Playhouse Hopscotch Balance beam Spring rider Water play area Ball pit Tunnel Zip line Basketball hoop Bicycle rack Spinner Climbing wall Rope ladder Tetherball Flying fox Swinging bridge Spiral slide Water sprinkler Pedal go-kart Miniature golf course
immutable_promptsticker, Cartoon, ``
random_sample

Prompt variation is where a lot of ComfyUI batching lives: one subject pool, one template, N outputs to pick from. prompt - random from the ymc suite is a compact take on that - you give it a list of choices and a template, and it emits a list of prompt strings (up to 1000 of them) that you can loop through or sample.

It's adapted from the mixlab nodes family, and the default content is telling: a playground full of playground equipment. The mechanism is what matters, not the example.

How it works

The node does a Cartesian product between two multi-line inputs:

  • mutable_prompt - the pool. One option per line (Swing, Slide, Climbing frame, …).
  • immutable_prompt - the template. One template per line, and `` (double backtick) is the hole where each mutable option gets dropped in.

So with a template of sticker, Cartoon, `` and a pool of 30 playground items, you get sticker, Cartoon, Swing, sticker, Cartoon, Slide, and so on - 30 prompts. max_count caps the list length. With random_sample set to enable, it picks a random sample of that many from the full product; with disable, it takes the first max_count in order. The optional seed input (an "any" type, so it can be wired from a seed source) makes the random pick reproducible.

Because the output is a list (STRING list), you pair it with anything that consumes a list of prompts - a loop over prompts, or a batch that encodes each one. One node becomes a mini A/B test rig: 30 variations, generated in one queue.

Inputs and outputs

The three that matter:

  • mutable_prompt - your pool of choices, one per line
  • immutable_prompt - the template, `` as the placeholder
  • max_count - how many results to emit (1–1000, default 9)

Plus random_sample (enable/disable) and the optional seed. Output is one STRING list. It also shows the generated prompts in its UI preview.

Installing it

Part of ymc-node-suite-comfyui:

  • ComfyUI Manager → search ymc-node-suite-comfyui → Install → restart, or
cd ComfyUI/custom_nodes
git clone https://github.com/YMC-GitHub/ymc-node-suite-comfyui

restart, and pip install -r requirements.txt on a manual clone (four yors_* helper libs; auto-install is commented out). No models, no GPU.

Search prompt / random on the canvas or use the right-click ymc suite menu.

Common issues

  • "It only returned one line of my template." The `` placeholder is required for substitution - if your template line has no ``, the whole immutable line is used as-is and combined with every pool item (the node appends , `` if it's missing, so mostly this "just works"). Empty pool lines are skipped.
  • max_count is a ceiling, not a guarantee. If the product has fewer combos, you get fewer results.
  • The seed only matters when random_sample is enable. In disable mode the first N are taken deterministically regardless of seed.
  • WAS Node Suite conflicts on the pack's io/save nodes can appear if you run both packs - unrelated, but a common post-install warning.

If you want variation within a single prompt instead - same tags, different order - the pack's prompt - shuffle does that with a seed and keeps a chosen prefix fixed.

Categoryymc suite/text

Inputs (5)

NameTypeDefaultDescription
max_countINT91–1000
mutable_promptSTRINGSwing Slide Climbing frame Sandbox See-saw Merry-go-round Jungle gym Trampoline Monkey bars Rocking horse Playhouse Hopscotch Balance beam Spring rider Water play area Ball pit Tunnel Zip line Basketball hoop Bicycle rack Spinner Climbing wall Rope ladder Tetherball Flying fox Swinging bridge Spiral slide Water sprinkler Pedal go-kart Miniature golf course
immutable_promptSTRINGsticker, Cartoon, ``
random_sampleCOMBO2 options: enable, disable
seedopt*00–18446744073709550000

Outputs (1)

NameTypeDescription
STRINGSTRING