Save 4 hours! We auto-setup your workflow! Free!

Drop your workflow.json — we handle every dependency, custom node, and model. Just open the link and run.

Auto-Setup Workflow Json (Free) Now!
ComfyUI > Nodes > ComfyUI_SamplingUtils > RandomIntRange

ComfyUI Node: RandomIntRange

Class Name

PrimitiveRandomIntRange

Category
utils/primitive
Author
silveroxides (Account age: 2211days)
Extension
ComfyUI_SamplingUtils
Latest Updated
2026-06-03
Github Stars
0.02K

How to Install ComfyUI_SamplingUtils

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

RandomIntRange Description

Generate random integer within specified range for introducing variability and randomness into projects.

RandomIntRange:

The PrimitiveRandomIntRange node is designed to generate a random integer within a specified range, providing a simple yet powerful tool for introducing variability and randomness into your projects. This node is particularly useful in scenarios where you need to simulate random events or generate random values for testing and experimentation. By allowing you to specify a range and a seed, it ensures that you can control the randomness to some extent, making it possible to reproduce results if needed. The node's primary function is to take a minimum and maximum value, along with an optional seed, and produce a random integer that falls within the specified range. This capability is essential for tasks that require random sampling or stochastic processes, offering a straightforward way to incorporate randomness into your workflows.

RandomIntRange Input Parameters:

min

The min parameter specifies the lower bound of the range from which the random integer will be drawn. It defines the smallest possible value that can be generated by the node. The minimum value for this parameter is -sys.maxsize, and the maximum value is sys.maxsize. By default, this parameter is set to 0. Adjusting this parameter allows you to control the starting point of the random range, which can be crucial for ensuring that the generated values fit within the desired context of your project.

max

The max parameter sets the upper bound of the range for the random integer generation. It determines the largest possible value that can be produced by the node. Similar to the min parameter, its minimum value is -sys.maxsize, and the maximum value is sys.maxsize. The default value for this parameter is 100. This parameter is essential for defining the endpoint of the random range, ensuring that the generated integers do not exceed a certain threshold, which can be important for maintaining consistency and relevance in your outputs.

seed

The seed parameter is used to initialize the random number generator, allowing for reproducibility of results. By providing a specific seed value, you can ensure that the sequence of random numbers generated is the same each time the node is executed with the same inputs. The minimum value for this parameter is 0, and the maximum value is 0xffffffffffffffff. The default value is 0. This parameter is particularly useful when you need to replicate experiments or maintain consistency across different runs, as it allows you to control the randomness to a certain degree.

RandomIntRange Output Parameters:

random_integer

The random_integer output is the result of the node's execution, providing a single integer value that falls within the specified range defined by the min and max input parameters. This output is crucial for any application or process that requires a random integer, as it serves as the primary product of the node's functionality. The generated integer can be used in various contexts, such as simulations, random sampling, or any scenario where a degree of unpredictability is desired.

RandomIntRange Usage Tips:

  • To ensure reproducibility of your results, always use a specific seed value when you need to generate the same sequence of random numbers across different runs.
  • Adjust the min and max parameters carefully to fit the context of your project, ensuring that the generated random integers are meaningful and relevant to your specific use case.

RandomIntRange Common Errors and Solutions:

ValueError: empty range for randrange()

  • Explanation: This error occurs when the min and max parameters are set to the same value, resulting in an empty range for the random number generation.
  • Solution: Ensure that the max parameter is greater than the min parameter to define a valid range for random integer generation.

TypeError: 'int' object is not callable

  • Explanation: This error might occur if there is a conflict with variable names or incorrect usage of the random module.
  • Solution: Check your code for any naming conflicts or incorrect usage of functions, especially if you have overridden built-in functions or modules.

RandomIntRange Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI_SamplingUtils
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.

RandomIntRange