ComfyUI > Nodes > ComfyUI-CoCoTools > Random Int

ComfyUI Node: Random Int

Class Name

RandomIntNode

Category
COCO Tools/File Logistics
Author
Conor-Collins (Account age: 431days)
Extension
ComfyUI-CoCoTools
Latest Updated
2025-03-05
Github Stars
0.03K

How to Install ComfyUI-CoCoTools

Install this extension via the ComfyUI Manager by searching for ComfyUI-CoCoTools
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-CoCoTools 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

Random Int Description

Generate random integers within specified range for creative projects, with control over variability and reproducibility.

Random Int:

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.

Random Int Input Parameters:

low

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.

high

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.

seed

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.

use_padding

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.

padding_length

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.

Random Int Output Parameters:

random_integer_str

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.

random_integer

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.

Random Int Usage Tips:

  • To ensure reproducibility in your projects, always set a specific seed value when using the RandomIntNode. This will allow you to generate the same sequence of random numbers across different sessions.
  • Use the 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.

Random Int Common Errors and Solutions:

'high' must be greater than 'low'

  • Explanation: This error occurs when the 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.
  • Solution: Ensure that the 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.

Random Int Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-CoCoTools
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 Playground, enabling artists to harness the latest AI tools to create incredible art.