ComfyUI > Nodes > Basic data handling > pop random

ComfyUI Node: pop random

Class Name

Basic data handling: ListPopRandom

Category
Basic/LIST
Author
StableLlama (Account age: 861days)
Extension
Basic data handling
Latest Updated
2026-05-07
Github Stars
0.04K

How to Install Basic data handling

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

pop random Description

Randomly removes and returns an element from a list, ensuring fair data handling.

pop random:

The ListPopRandom node is designed to enhance your data manipulation capabilities by allowing you to randomly remove and retrieve an element from a list. This node is particularly useful when you need to introduce an element of randomness into your data processing workflow, such as when creating randomized outputs or sampling data. By taking a list as input, the node efficiently removes a random element and returns both the modified list and the removed element. This functionality can be beneficial in scenarios where you need to ensure that each element has an equal chance of being selected, thereby facilitating fair and unbiased data handling. If the list is empty, the node gracefully handles the situation by returning None for the removed element, ensuring that your workflow remains robust and error-free.

pop random Input Parameters:

list

The list parameter is the primary input for the ListPopRandom node. It accepts a list of any data type, allowing you to work with diverse datasets. The function of this parameter is to provide the node with the data from which a random element will be removed. The impact of this parameter on the node's execution is significant, as the randomness and the outcome depend on the contents of the list. There are no specific minimum or maximum values for this parameter, as it can handle lists of any length, including empty lists. However, if the list is empty, the node will return None for the removed element. This parameter does not have a default value and must be provided for the node to function.

pop random Output Parameters:

list

The list output parameter provides the modified list after a random element has been removed. This output is crucial as it allows you to continue processing the list without the removed element, maintaining the integrity of your data workflow. The modified list retains all elements except the one that was randomly selected and removed.

item

The item output parameter returns the element that was randomly removed from the list. This output is important for understanding which element was selected and removed, allowing you to use this information in subsequent processing steps. If the input list is empty, this parameter will return None, indicating that no element was available for removal.

pop random Usage Tips:

  • Use the ListPopRandom node when you need to introduce randomness into your data processing, such as for sampling or creating randomized outputs.
  • Ensure that the input list is not empty to avoid receiving None as the removed element, unless handling empty lists is part of your workflow.

pop random Common Errors and Solutions:

Empty List Error

  • Explanation: This error occurs when the input list is empty, resulting in None being returned as the removed element.
  • Solution: Ensure that the input list contains at least one element before passing it to the node. You can add a check in your workflow to handle empty lists appropriately.

TypeError: 'NoneType' object is not iterable

  • Explanation: This error may occur if you attempt to iterate over the item output when it is None.
  • Solution: Implement a conditional check to verify that the item output is not None before attempting to iterate over it or use it in operations that require a valid element.

pop random Related Nodes

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

pop random