LayerStyle

2167
By chflame
Updated 15 days ago
View on GitHub →See Common Issues →

A set of nodes for ComfyUI that can composite layer and mask to achieve Photoshop like functionality.

Available Nodes

LayerUtility: RandomGenerator

LayerUtility: RandomGenerator Node Documentation

Overview

The LayerUtility: RandomGenerator is a node within the ComfyUI framework, designed to generate random numbers with specific characteristics. It can produce a random integer, float, and boolean value, making it a versatile tool in workflows that require randomness or probabilistic variation.

Functionality

The RandomGenerator node generates random numbers based on specified input parameters. The randomness is controlled through seeding to ensure either consistent outputs (if desired) or completely random results. The node is capable of working with batch processes, making it suitable for scenarios involving multiple data points, particularly when there is an image-based batch input.

Inputs

The node accepts the following inputs:

  1. min_value: This is the minimum float value for the random number generation. Users can specify a wide range, with the default starting at 0.

  2. max_value: This sets the maximum float value allowed in the random number generation, defaulting to 10.

  3. float_decimal_places: Determines the precision of the generated float, allowing users to specify up to 14 decimal places.

  4. fix_seed: A boolean input that lets users decide whether to fix the seed for consistent outputs across different executions. If set to True, the same sequence of numbers is generated every run.

  5. image (Optional): If an image is provided, the node will adjust its batch processing accordingly. The number of generated random values will match the batch size determined by the image's dimensions.

Outputs

The RandomGenerator node produces three types of outputs:

  1. Integer: A randomly generated integer derived from the random float.

  2. Float: A randomly generated float rounded to the specified number of decimal places.

  3. Boolean: A random boolean value that can be used for binary decision-making. It is determined by whether the integer version of the random float is even or odd.

Usage in ComfyUI Workflows

The RandomGenerator node can be integrated into various ComfyUI workflows where randomness or variability is needed:

  • Probabilistic Modeling: Useful in workflows that require sampling or stochastic processes, where random inputs need to be tested or simulated.

  • Dynamic Value Assignment: Automatically assigning different dynamic values to variables or conditions in workflows to simulate real-world variability or to perform stress testing.

  • Random Texture or Effect Generation: When combined with visual nodes, this node can introduce random effects or textures over an image batch, useful in media processing scenarios.

Special Features and Considerations

  • Seeding: The ability to fix a seed allows for repeatable experiments, important in testing scenarios or when validating a model against a specific set of random inputs.

  • Batch Size Adaptation: The node automatically adapts the number of random values it generates to match the batch size indicated by an image input, ensuring consistency and integration within larger data-processing pipelines.

  • Precision Customization: Users can define exactly how precise the random float should be, accommodating both large-scale and highly detailed simulations.

This RandomGenerator node is an essential tool for users looking to incorporate controlled randomness into their workflows seamlessly. Its versatility and adaptability make it a valuable component within the ComfyUI ecosystem.