Files
Derfuu-Derfuu_ComfyUI_Modde…/pyscripts/Nodes/Functions/Random.py
T
Derfuu 665c3f10b1 Debug node get additional output to be able for use in-line with other nodes;
Removed(commented) "Tuples" nodes;
Removed "TUPLES" type from "Get size" nodes; (DON'T FORGET TO REPLACE THEM IF THEY'RE PERSISTS IN YOUR WORKFLOW)
Types moved into their own class with class methods and default parameters instead of just tuples with strings and dicts;
Added "Logic node" (>, <, =, AND, OR, XOR); (idk why i did this one, but got an idea that with object recognition models to count objects and correct them in next iterations would be not so bad idea as i think. Or something like this)
changed README.md to current state of this repo
2024-04-03 03:07:33 +03:00

32 lines
790 B
Python

import sys
from numpy import random
from custom_nodes.Derfuu_ComfyUI_ModdedNodes.pyscripts.components.fields import Field
from custom_nodes.Derfuu_ComfyUI_ModdedNodes.pyscripts.components.tree import TREE_FUNCTIONS
class RandomValue:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"Value_A": Field.float(default=0),
"Value_B": Field.float(default=1),
"seed": Field.int(default=0, min=0, max=2**32-1),
}
}
RETURN_TYPES = ("FLOAT",)
FUNCTION = "get_rand"
CATEGORY = TREE_FUNCTIONS
def get_rand(self, Value_A, Value_B, seed):
random.seed(seed)
value = random.uniform(Value_A, Value_B)
return (value,)