ComfyUI > Nodes > ComfyUI-LogicUtils > Uniform Random Float

ComfyUI Node: Uniform Random Float

Class Name

UniformRandomFloat

Category
Logic Gates
Author
aria1th (Account age: 3016days)
Extension
ComfyUI-LogicUtils
Latest Updated
2026-01-21
Github Stars
0.1K

How to Install ComfyUI-LogicUtils

Install this extension via the ComfyUI Manager by searching for ComfyUI-LogicUtils
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-LogicUtils in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Uniform Random Float Description

Generates a uniformly distributed random float within a specified range, with precision and reproducibility.

Uniform Random Float:

The UniformRandomFloat node is designed to generate a random floating-point number within a specified range, offering a simple yet powerful tool for introducing randomness into your projects. This node is particularly useful when you need a random float value between two boundaries, ensuring that the number is uniformly distributed across the range. If the minimum value specified is greater than the maximum, the node gracefully defaults to the minimum value, preventing errors and ensuring smooth operation. This feature makes it a reliable choice for scenarios where dynamic range adjustments might occur. By allowing you to specify the number of decimal places, the node provides flexibility in precision, catering to both coarse and fine-grained randomness needs. The inclusion of a seed parameter ensures that you can reproduce the same sequence of random numbers if needed, which is essential for debugging or creating repeatable results in artistic projects.

Uniform Random Float Input Parameters:

min_val

This parameter defines the lower boundary of the range from which the random float will be selected. It plays a crucial role in determining the starting point of the random number generation. The minimum value allowed is -999999999, and the maximum is 999999999.0, with a default value of 0.0. Adjusting this parameter allows you to control the lower limit of your random number range.

max_val

This parameter sets the upper boundary of the range for the random float selection. It is essential for defining the endpoint of the random number generation. The minimum value allowed is -999999999, and the maximum is 999999999.0, with a default value of 1.0. By modifying this parameter, you can control the upper limit of your random number range.

decimal_places

This parameter specifies the number of decimal places to which the generated random float should be rounded. It affects the precision of the output, allowing you to choose between more precise or more generalized random numbers. The minimum value is 0, which results in an integer, and the maximum is 10, with a default value of 1. This flexibility enables you to tailor the precision of the random float to your specific needs.

seed

The seed parameter is used to initialize the random number generator, ensuring that the sequence of random numbers can be reproduced if needed. This is particularly useful for debugging or when consistent results are required across different runs. The minimum value is 0, and the maximum is 2^63-1, with a default value of 0. By setting this parameter, you can achieve repeatable randomness in your projects.

Uniform Random Float Output Parameters:

FLOAT

The output of the UniformRandomFloat node is a single floating-point number that falls within the specified range defined by min_val and max_val. This number is uniformly distributed, meaning each possible value within the range has an equal chance of being selected. The precision of this output is determined by the decimal_places parameter, allowing you to control how many decimal points are included. This output is crucial for applications requiring randomization, such as procedural generation or stochastic simulations, where variability and unpredictability are desired.

Uniform Random Float Usage Tips:

  • To ensure reproducibility of random numbers, always set the seed parameter to a specific value when you need consistent results across different runs.
  • Use the decimal_places parameter to control the precision of your random numbers, which can be particularly useful when you need to match the precision of other data in your project.

Uniform Random Float Common Errors and Solutions:

"min_val is greater than max_val"

  • Explanation: This error occurs when the minimum value specified is greater than the maximum value, which is logically incorrect for defining a range.
  • Solution: Ensure that min_val is less than or equal to max_val. If this condition is not met, the node will default to using min_val as the output, which may not be the intended behavior.

"Invalid decimal_places value"

  • Explanation: This error arises when the decimal_places parameter is set outside its allowed range (0 to 10).
  • Solution: Adjust the decimal_places parameter to be within the valid range. This ensures that the output precision is correctly applied to the generated random float.

Uniform Random Float Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-LogicUtils
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.