π² Random Float in Range
Wander Your CFG and Denoise Instead of Tuning Them by Hand
- random_float
Most people search for the right CFG by typing a number, queueing, typing another number, queueing. Twenty minutes, ten images, two useful data points. π² Random Float in Range does that sweep for you: set 4.0 to 7.5, queue a batch, and sort the keepers afterwards. Same story for denoise on an img2img pass - 0.4 to 0.75 in one run tells you more about your image than any tutorial.
It's a decimal-roll node, and the decimals input is what makes it pleasant. Rolling 6.28491734 for a CFG value is noise you don't need.
How it works
min_value and max_value are floats - the range stretches to Β±1e10, so huge bounds are fine - and if you enter them backwards the node swaps them for you. The draw is uniform across that range, inclusive at the ends in practice.
decimals rounds the result: -1 (the default) keeps full precision, 0 gives a whole number as a float, 2 gives 6.28. Rounding with 0 is a nice trick for randomising a denoise into tidy steps without reaching for the integer node.
seed defaults to -1. A value β₯ 0 makes the roll reproducible via a locally seeded RNG; -1 means "fresh each execution". Heads up on caching: the pack's random nodes only re-roll when the node actually executes, and ComfyUI skips cached nodes whose inputs didn't change. The plain Random Seed node in the pack forces a re-run with a timestamp fingerprint; this one doesn't. If your "random" value looks frozen, that's the cache - change something upstream, or set a seed and increment it.
Inputs and outputs
Two required inputs, min_value and max_value, both FLOAT; two optional ones, decimals and seed. One output, random_float, FLOAT.
The natural wiring is CFG or denoise on a KSampler: right-click the widget β Convert widget to input β connect. Both are direct float inputs, no conversion needed. Beyond that it's any float widget - a LoRA strength on a loader you've converted, an upscale factor, a mask feather radius.
Keep the range honest. Randomising CFG between 2 and 12 is not an experiment, it's a lottery; one end of that produces mud and the other produces charcoal. Between 4.5 and 6.5 is a range where every result is technically a picture and you're actually comparing something.
Install
ComfyUI Manager β search "ComfyUI-mnemic-nodes" β install β restart. Alternatively:
cd ComfyUI/custom_nodes
git clone https://github.com/MNeMoNiCuZ/ComfyUI-mnemic-nodes
Pure Python node; the pack's requirements.txt installs a heavier set (transformers, opencv-python, tiktoken, piexif) for its other nodes. No model downloads and no API keys.
Common issues
The value never changes. Cache or a fixed seed. Also check nothing downstream is being served from a cached run - swap a node's input to force recomputation.
Endless decimal places. decimals is still at -1. Set it to 1 or 2.
Wired it to a node and nothing happens. You connected to a widget that's still a widget. It must be converted to an input first, and the converted socket keeps the original type - FLOAT here, so it won't satisfy an integer input.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| min_value | FLOAT | 0.000-10000000000β10000000000 | Minimum value for the random float (inclusive). |
| max_value | FLOAT | 1.000-10000000000β10000000000 | Maximum value for the random float (inclusive). |
| decimalsopt | INT | -1-1β10 | Number of decimal places to round to. Use -1 for no rounding (full precision). |
| seedopt | INT | -1-1β18446744073709550000 | Seed for random number generator. Use -1 for random seed (different each time), or set a specific value for reproducibility. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| random_float | FLOAT | The rolled number, inside the range set above. |