Nodes/ComfyUI_StringOps/随机打乱🐠meeeyo.com
ComfyUI Node

随机打乱🐠meeeyo.com

Randomize your lines, fresh every single run

By MeeeyoAI·Created 2 years ago·Updated about a year ago· 209
随机打乱🐠meeeyo.com
  • any
  • STRING
input_text
delimiter分隔符

Some lists you want in order, and some you want scrambled - ideally a different scramble each time you queue a run. ShuffleTextLines does the second one: it takes your multiline text, splits it into lines, shuffles them with Python's random.shuffle, and hands back the same lines in a random order.

The Chinese display name (随机打乱, "random shuffle") says it plainly. It's part of ComfyUI_StringOps, and the behavior that matters most is hidden in the details: this pack never caches its results (every node reports "changed" on every poll), so this node actually re-shuffles on every run. That's the whole point - if you set this up expecting one shuffle that stays fixed, you'll be surprised.

How it works

Two inputs:

  • input_text - your multiline source.
  • delimiter - how lines are split. Empty or \n means newlines; anything else (a comma, a |) splits on that instead.

It strips out blank lines before shuffling, so empty rows don't survive. Then it rejoins with the same delimiter you split with. The delimiter default is the Chinese placeholder 分隔符 ("delimiter") - if you leave it as that literal string, the node will try to split on the text "分隔符," which won't match anything, and the whole text becomes one line that then gets "shuffled" into itself. That's the one real trap: change the default delimiter to empty or \n for newline-splitting.

Output is a single STRING.

Where you'd use it

Prompt batch variation is the classic use. Keep a list of style adjectives, subjects, or lighting cues - one per line - and shuffle before combining with the pack's TextConcatenation or TextConcatenator. Each queue run gives you a different combination, which is the cheap way to get variety out of a fixed batch without a full random-prompt system. It's also handy for shuffling a list of prompts you're about to feed through TextToList and into a batch sampler, or just for randomizing the order of a queue.

The catch

It's genuinely random - there's no seed input, no "shuffle once and keep" mode, no "same shuffle for this batch" option. If you want reproducibility, you'll need to shuffle outside (or capture the output and paste it back as a fixed string). And because shuffling happens at graph-evaluation time, two nodes consuming the same ShuffleTextLines output in one run do see the same shuffled result for that run - the new shuffle only happens on the next queue - which is usually what you want for consistency within a batch.

Installing it

Pack standard: ComfyUI Manager → ComfyUI_StringOps, or

cd ComfyUI/custom_nodes
git clone https://github.com/MeeeyoAI/ComfyUI_StringOps.git

Restart. Pure Python, no extra deps.

The honest take

A two-input shuffle node is a small thing, but "actually different every run" is the feature that makes it worth having over a manual paste. Just remember the delimiter default is a placeholder, and if you ever need the same order twice, this node is the wrong tool - freeze the output instead.

CategoryMeeeyo/String

Inputs (3)

NameTypeDefaultDescription
input_textSTRING
delimiterSTRING分隔符
anyopt*

Outputs (1)

NameTypeDescription
STRINGSTRING