π± Artha Math Random
A Random Node That Actually Gives You a New Number Every Run
- value
- number
Random number nodes in ComfyUI are a classic trap. The stock ones cache their result against their inputs, so a "random" seed connected to your KSampler quietly produces the same value on every run unless you go jiggle the seed box. ArthaMathRandom does the opposite, and that's the whole selling point.
It's from the ComfyUI-Artha-Nodes pack - Cyrostar's grab-bag of math, logic, project, and image helpers. Zero setup, no API key, nothing to download.
How it works
Two inputs define a range: range_min and range_max, both integers from 0 up to 2^63β1 (defaults 1 and 100). The node sorts them internally, so you don't have to remember which is bigger - min/max mixups just work out. It returns a random integer in that range, inclusive.
The outputs are value (INT) and number (STRING) - the same integer twice, once for wiring into numeric inputs and once for display.
The clever bit is invisible: the node's fingerprint - ComfyUI's way of deciding "inputs unchanged, reuse the cached result" - is deliberately set to nan, which is never equal to itself. That forces ComfyUI to re-execute the node on every run, no matter what. Same inputs, new random value, every single time. That's the difference between this and the random nodes that catch people out.
What to use it for
- A fresh seed every run: wire
valueinto your KSampler's seed input and every run gets a genuinely new starting point - great for batch-farming ideas quickly. - Randomizing non-seed parameters: LoRA strength, CFG, denoise, whatever input you want to wobble between runs.
- Feeding ArthaProjectSeed if you want to log what it picked.
One honest caveat: "random every run" is the feature, and it's also the limitation. The whole discipline of good seed-farming is locking a seed and changing one variable at a time. This node fights that by design. If you find a good image, capture the value it generated and pin it in a plain seed node before you keep going - otherwise the lucky run is gone forever.
Installing it
Same pack as the rest of the Artha nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/Cyrostar/ComfyUI-Artha-Nodes
cd ComfyUI-Artha-Nodes
pip install -r requirements.txt
# Windows portable: python_embeded\python.exe -m pip install -r requirements.txt
or just search "ComfyUI-Artha-Nodes" in ComfyUI Manager and install from there. Restart ComfyUI either way. Note the pack registers via the newer extension API, so an out-of-date ComfyUI may not show the node at all - update first if it's missing.
Gotchas
Two things. The range caps at 2^63β1, which is plenty for seeds but worth knowing if you were planning on absurd values. And the "always re-execute" behavior applies mid-workflow too: rerun the graph and the number changes again, so don't use it anywhere you need determinism. For everything else, it's the rare random node that does what its name says.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| range_min | INT | 10β9223372036854776000 | β |
| range_max | INT | 1000β9223372036854776000 | β |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| value | INT | β |
| number | STRING | β |