Visit ComfyUI Online for ready-to-use ComfyUI environment
Generate random integers within specified range for creative projects, with control over variability and reproducibility.
The RandomIntNode is designed to generate a random integer within a specified range, providing flexibility and control over the randomness in your creative projects. This node is particularly useful when you need to introduce variability or randomness into your work, such as generating random values for procedural art or simulations. It allows you to specify a range for the random integer, ensuring that the generated number falls within your desired limits. Additionally, the node offers the option to use a seed for reproducibility, meaning you can generate the same sequence of random numbers if needed. An optional feature of this node is the ability to pad the generated integer with leading zeros, which can be useful for formatting purposes or when a specific string length is required.
The low
parameter defines the lower bound of the range from which the random integer will be generated. It ensures that the random number is not less than this value. The minimum value for low
is -2147483648, and the maximum is 2147483647, with a default value of 1. This parameter is crucial for setting the starting point of your random number range.
The high
parameter sets the upper bound of the range for the random integer generation. The random number will be less than or equal to this value. Like low
, it has a minimum value of -2147483648 and a maximum of 2147483647, with a default value of 745. This parameter is essential for defining the endpoint of your random number range.
The seed
parameter is used to initialize the random number generator, allowing for reproducible results. By setting a specific seed, you can ensure that the same sequence of random numbers is generated each time. The minimum value is 0, and the maximum is 0xffffffffffffffff, with a default value of 0. This parameter is particularly useful when consistency is required across different runs.
The use_padding
parameter is a boolean toggle that determines whether the generated random integer should be padded with leading zeros. When set to True
, the output will be a string with zeros added to the left to reach a specified length. The default value is False
, meaning no padding is applied unless explicitly enabled.
The padding_length
parameter specifies the total length of the string when padding is applied. It is only relevant if use_padding
is set to True
. The minimum value is 1, and the maximum is 20, with a default value of 4. This parameter allows you to control the formatting of the output string, ensuring it meets specific length requirements.
The random_integer_str
output is a string representation of the generated random integer. If padding is enabled, this string will include leading zeros to reach the specified length. This output is useful for scenarios where a formatted string is required, such as file naming or display purposes.
The random_integer
output is the original integer value generated by the node. This output provides the raw numerical value, which can be used directly in calculations or further processing. It is essential for applications where the integer itself is needed rather than a formatted string.
use_padding
and padding_length
parameters to format the output string when a specific length is required, such as for consistent file naming conventions or when aligning numbers in a list.'high' must be greater than 'low'
high
parameter is set to a value less than or equal to the low
parameter, which is not allowed as it would result in an invalid range for random number generation.high
parameter is set to a value greater than the low
parameter to define a valid range for the random integer generation. Adjust the values accordingly to resolve this error.RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.