Nodes/ComfyUI Layer Style/LayerUtility: Random Generator V2
ComfyUI Node Runs on cloud

LayerUtility: Random Generator V2

Random Generator V2 — the reproducible version

By chflame163·Created 3 years ago·Updated 4 days ago· 3,113
LayerUtility: Random Generator V2
  • image
  • int
  • float
  • bool
â—„min_value0.00â–º
â—„max_value10.00â–º
â—„least0.00â–º
â—„float_decimal_places1â–º
â—„seed0â–º

Same job as the original Random Generator - spit out a random int, float, and bool from one node - but with the one thing that node was missing: an actual seed. Instead of a blunt "frozen or not" toggle, V2 gives you a numeric seed you can pin, share, and reuse, the same way you'd lock a KSampler's seed to reproduce a specific generation.

How it works

min_value and max_value set the range, same as V1. What's new is seed - plug in the same number twice and you get the same draw twice, which is the whole point of a seed: not "no randomness," but repeatable randomness. Change the seed and you get a different draw from the same range. This matters if you ever need to hand a workflow to someone else and have them reproduce your exact random pick, or if you're sweeping seeds deliberately to explore a range of outcomes.

There's also least, which sets a floor on how fine-grained the draws are allowed to be - leave it at its default of 0 unless you specifically want to constrain how tightly the random values can cluster together. Most people will never touch it.

Like the original, it also takes an optional image input purely as a change-signal - wiring something into it is a common way to force the node to re-evaluate alongside an upstream image rather than sitting on a cached value.

The inputs and outputs that matter

  • min_value / max_value - the draw range.
  • seed - the number that makes the draw reproducible. Same seed, same range, same result.
  • float_decimal_places - rounding for the float output.
  • least - a fine-grained floor most people leave alone.

Outputs are identical to V1: int, float, and bool, all drawn together in one execution.

How to install it

Ships with LayerStyle. ComfyUI Manager: search ComfyUI Layer Style, install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_LayerStyle
pip install -r ComfyUI_LayerStyle/requirements.txt

Restart and look under 😺dzNodes → LayerUtility → Data. Nothing to download - it's the same lightweight utility node as V1, just with a seed added.

Common issues

If your "random" values suddenly aren't changing between runs, that's expected behavior here, not a bug - a fixed seed value will always draw the same result for the same range. If you want it to actually vary, either randomize the seed widget yourself (right-click it for ComfyUI's usual increment/randomize controls) or wire an upstream image into the optional image input so it re-evaluates with each new generation.

Beyond that, the same pack-wide caveat applies as everywhere else in LayerStyle: if the node's missing from your menu entirely, the whole pack failed to import - usually a transformers/tensorflow version clash, and especially common on an install from before the pack was split into base LayerStyle and the dependency-heavier LayerStyle Advance repo. Fix the import (reinstall clean, or Manager's "Try Fix") rather than assuming this specific node is broken.

Category😺dzNodes/LayerUtility/Data

Inputs (6)

NameTypeDefaultDescription
min_valueFLOAT0.00-100000000000000–100000000000000—
max_valueFLOAT10.00-100000000000000–100000000000000—
leastFLOAT0.000–100000000000000—
float_decimal_placesINT11–14—
seedINT00–100000000000000—
imageoptIMAGE—

Outputs (3)

NameTypeDescription
intINT—
floatFLOAT—
boolBOOLEAN—