WK Integer Generator
The value node that rerolls its own number before every queue
- integer
- string
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
-4and2you get seven possible integers, not six. The draw ismin + floor(random × (max - min + 1)), so-4and2are both live. - Increment and decrement stop at the bound rather than wrapping.
steponly applies to increment/decrement. Randomize ignores it entirely.- A linked
valueinput wins. If you convertedvalueto 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 asrandomizeon 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
-4to2. - 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, so2.0fails even though it looks like2. - It won't stay put. Default mode is randomize and the mode isn't saved. Switch to
fixedafter 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.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| value | INT | 0-1000000000–1000000000 | — |
| min_value | INT | -4-1000000000–1000000000 | — |
| max_value | INT | 2-1000000000–1000000000 | — |
| step | INT | 11–1000000000 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| integer | INT | — |
| string | STRING | — |