Nodes/ComfyUI_StringOps/生成范围数组🐠meeeyo.com
ComfyUI Node

生成范围数组🐠meeeyo.com

Build a padded number list for batch queues without math nodes

By MeeeyoAI·Created 2 years ago·Updated about a year ago· 209
生成范围数组🐠meeeyo.com
  • any
  • STRING
range_rule3|1-10
mode顺序
prefix_suffix|

You know those workflows that batch 50 images by feeding a list of numbers into a prompt? Someone always ends up hand-typing 001, 002, 003… or stacking range nodes. GenerateNumbers (生成范围数组 - "generate range array") is the cheat code: one string describes the whole sequence, and it spits out a ready-to-use number list, zero-padded, with optional prefix/suffix, in order or shuffled. One STRING output - drop it into a TextToList or a batch node and go.

How it works

Three inputs. The important one is range_rule, a compact |-separated spec. Default is 3|1-10:

  • 3 is the zero-pad width - numbers get padded to 3 digits, so you get 001, 002, …
  • 1-10 is the range - start to end, inclusive on both ends

A single number works too: 2|5 means pad to 2 digits and list 01 through 05. And prefix_suffix lets you wrap each item - img|.png with the default pad gives img001.png, img002.png, …. The default | (empty on both sides) means no wrapper.

The mode dropdown is where it gets interesting: 顺序 (sequential) or 随机 (random). Random shuffles the whole list once before output - a neat way to scramble a seed list or batch order per run if you're using it as a random-ish driver.

Output is a single STRING with one number per line, which is exactly the shape ComfyUI's list-into-prompt nodes expect.

Where it fits

Batch automation. If you're iterating a prompt template over an index, generating a set of filenames, or building a numbered queue for a video frame pass, this produces the list in one node instead of a pile of Math + Range nodes. It's the pack's other number utility alongside FloatToInteger - one for snapping single values, one for generating whole sequences.

Install

Part of ComfyUI_StringOps:

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

Restart after, or use ComfyUI Manager → "ComfyUI_StringOps". No models, no special dependencies. Chinese UI (生成范围数组) with the 🐠meeeyo.com branding and the author's contact ad in the node description, like the rest of the pack.

Common issues

The | separator is the whole grammar, and it's easy to fat-finger. Forgetting the range part (3| ) breaks the split and you get an empty string. Also, zero-padding only pads - it never truncates: 2|1-100 gives you 100 as-is, not a truncated 00. If you wanted filenames that stay a fixed width past 99, that's beyond this node.

And a subtle one: the random mode shuffles once per execution - this node re-runs whenever anything upstream changes (it's marked to always re-execute, like all the StringOps nodes). So a "random" list is random every time the graph re-runs, which may or may not be what you want. If you need a stable seed-scrambled order, shuffle a fixed seed list elsewhere.

Straightforward, compact, and it removes a surprisingly common annoyance in batch workflows. Learn the pad|range spec once and it becomes muscle memory.

CategoryMeeeyo/Number

Inputs (4)

NameTypeDefaultDescription
range_ruleSTRING3|1-10
modeCOMBO顺序2 options: 顺序, 随机
prefix_suffixSTRING|
anyopt*

Outputs (1)

NameTypeDescription
STRINGSTRING