Nodes/ComfyUI WorkspaceKit/WK Integer Generator
ComfyUI Node

WK Integer Generator

The value node that rerolls its own number before every queue

By ZiYao00·Created 4 months ago·Updated 17 days ago· 5
WK Integer Generator
    • integer
    • string
    ◄value0►
    ◄min_value-4►
    ◄max_value2►
    ◄step1►

    What it's for

    Same job as its float sibling, one type over. WK Integer Generator is a whole number you define once and wire to as many places as need it: a step count, a batch index, a frame length, an "which strength bucket should this run use" picker, a counter that lives on the graph. It outputs the integer and a text version of it.

    It lives in ComfyUI WorkspaceKit (ZiYao00, public beta), under 🧩 WorkspaceKit/Utilities, alongside WK Float Generator, WK Resolution Preset (Legacy), WK Video Resolution, WK Video Duration and WK Video Frame Picker. Installing the pack gets you the whole workspace sidebar plugin too.

    How it works

    The backend is deliberately dumb: clamp value into [min_value, max_value], return it as INT and as str(value). That's it. No random number generation happens in Python at all - which is worth saying out loud, because it means an API-driven prompt that passes value directly gets exactly the number it asked for.

    The behaviour people actually come for is the frontend widget. Right under value the pack inserts a combo labelled control before generate, defaulting to randomize, offering fixed, increment, decrement and randomize. It's the same idea as ComfyUI's own control_after_generate - the KB's favourite beginner injury - except it hooks beforeQueued, so the value is rolled before the prompt is sent and the number in the box is the number that ran. No more "I found a good one and lost it by switching to fixed."

    Details that matter in practice:

    • Randomize covers both ends. With bounds of -4 and 2 you get seven possible integers, not six. The draw is min + floor(random × (max - min + 1)), so -4 and 2 are both live.
    • Increment and decrement stop at the bound rather than wrapping.
    • step only applies to increment/decrement. Randomize ignores it entirely.
    • A linked value input wins. If you converted value to a socket and wired something into it, the control does nothing - the wire owns the number. Partial queues are likewise skipped so unrelated nodes don't advance.
    • The control isn't saved with the workflow (serialize: false), so it comes back as randomize on reload. Assume per-session.

    The generator validates the boring way, with useful messages: non-integers get "Integer generator inputs must be whole numbers", and a minimum above the maximum is rejected rather than swapped for you.

    Inputs and outputs

    • value - the number. Defaults to 0.
    • min_value / max_value - the clamp and the random range. Defaults -4 to 2.
    • step - how far increment/decrement moves per queue. Minimum is 1, since this is the integer node.

    Outputs are integer (INT) and string (STRING). Right-click a downstream widget and Convert to input to accept the wire - that's the standard ComfyUI move. The string output is the sleeper feature: wire it into a filename_prefix or a note node and every file carries the number that produced it, which is how you keep a random run reproducible after the fact.

    One thing this is not: a seed node. It has no seed semantics, no history, no "restore this exact run" behaviour. For seeds, convert the sampler's own seed widget to an input and feed it from a primitive - the standard one-source-many-samplers pattern. This node is for values.

    Install

    Manager: search WorkspaceKit or comfyui-workspacekit, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ZiYao00/ComfyUI-WorkspaceKit.git
    cd ComfyUI-WorkspaceKit
    python -m pip install -r requirements.txt
    

    Windows portable, from the ComfyUI root:

    .\python_embeded\python.exe -m pip install -r .\ComfyUI\custom_nodes\ComfyUI-WorkspaceKit\requirements.txt
    

    The only listed dependency is send2trash - that's for the sidebar's recycle-bin support, not for this node. No checkpoints, no model downloads. Restart ComfyUI afterwards so the frontend extension loads and the control widget appears.

    Where it bites

    • The node loads but there's no "control before generate" box. You're on a cached frontend or the extension didn't load. Fully restart ComfyUI - a page refresh isn't always enough.
    • An error about whole numbers. Something upstream handed it a float. The check is type(x) is int, so 2.0 fails even though it looks like 2.
    • It won't stay put. Default mode is randomize and the mode isn't saved. Switch to fixed after loading if you're reproducing a run.
    • min_value > max_value. It tells you plainly. Swap them yourself; it won't.

    WorkspaceKit is public beta (0.2.6 at the time of writing, GPL-3.0-only, developed with Codex by a designer who says upfront he isn't a programmer). The README's own advice is to back up workflows and templates before using it in a real install. The utility nodes are well-tested and isolated; the sidebar that comes with them is the part still moving.

    Category🧩 WorkspaceKit/Utilities

    Inputs (4)

    NameTypeDefaultDescription
    valueINT0-1000000000–1000000000—
    min_valueINT-4-1000000000–1000000000—
    max_valueINT2-1000000000–1000000000—
    stepINT11–1000000000—

    Outputs (2)

    NameTypeDescription
    integerINT—
    stringSTRING—