ComfyUI  >  Nodes  >  ComfyUI-JDCN >  LogicUtil_Uniform Random Choice

ComfyUI Node: LogicUtil_Uniform Random Choice

Class Name

LogicUtil_UniformRandomChoice

Category
LogicUtil
Author
daxcay (Account age: 93 days)
Extension
ComfyUI-JDCN
Latest Updated
6/13/2024
Github Stars
0.1K

How to Install ComfyUI-JDCN

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

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

Run ComfyUI Online

LogicUtil_Uniform Random Choice Description

Randomly select item from string list for workflow randomness with seed for reproducible results.

LogicUtil_Uniform Random Choice:

The LogicUtil_UniformRandomChoice node is designed to randomly select an item from a list of choices provided in a string format. This node is particularly useful when you need to introduce an element of randomness into your workflow, such as selecting a random color, texture, or any other attribute from a predefined list. By parsing the input string based on a specified separator, the node ensures flexibility in how the choices are defined. The use of a seed value allows for reproducible results, which is beneficial for debugging or creating consistent outputs across different runs.

LogicUtil_Uniform Random Choice Input Parameters:

input_string

This parameter takes a string containing the list of choices separated by a specified character. The default value is "a$b$c", which means the choices are "a", "b", and "c". The input string can be customized to include any set of choices you want to randomize.

separator

The separator parameter defines the character used to split the input string into individual choices. The default value is "$". You can change this to any character that suits your input string format, ensuring that the choices are correctly parsed.

seed

The seed parameter is an integer that initializes the random number generator. The default value is 0. By setting a specific seed, you can ensure that the random choice is reproducible, which is useful for consistent results in repeated runs. The seed value can range from 0 to 9999999999.

LogicUtil_Uniform Random Choice Output Parameters:

STRING

The output is a single string, which is one of the choices from the input string, selected randomly based on the specified seed. This output can be used directly in your workflow wherever a random selection from a predefined list is needed.

LogicUtil_Uniform Random Choice Usage Tips:

  • Use a consistent separator character that does not appear in the choices themselves to avoid parsing errors.
  • Set the seed value to 0 for non-reproducible random choices, or use a specific seed for reproducible results.
  • Ensure the input string is correctly formatted with the separator to avoid unexpected results.

LogicUtil_Uniform Random Choice Common Errors and Solutions:

"IndexError: list index out of range"

  • Explanation: This error occurs if the input string does not contain the specified separator, resulting in an empty list of choices.
  • Solution: Ensure that the input string contains the separator character and that there are valid choices separated by this character.

"ValueError: empty separator"

  • Explanation: This error occurs if the separator parameter is set to an empty string.
  • Solution: Set the separator parameter to a valid character that is used to separate the choices in the input string.

"TypeError: seed must be an integer"

  • Explanation: This error occurs if the seed parameter is not an integer.
  • Solution: Ensure that the seed parameter is set to an integer value within the valid range (0 to 9999999999).

LogicUtil_Uniform Random Choice Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-JDCN
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.