This commit is contained in:
justumen
2024-11-01 09:31:56 +01:00
parent 06da237179
commit 7df528d1d9
16 changed files with 195 additions and 145 deletions

View File

@@ -1,31 +0,0 @@
import random
import hashlib
class TextToStringAndSeed:
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"text": ("STRING", {"forceInput": True}),
},
}
RETURN_NAMES = ("text","random_seed")
RETURN_TYPES = ("STRING", "INT")
FUNCTION = "process"
CATEGORY = "utils"
def process(self, text):
# Generate a hash from the input text
text_hash = hashlib.md5(text.encode()).hexdigest()
# Use the hash to seed the random number generator
random.seed(text_hash)
# Generate a random seed (integer)
random_seed = random.randint(0, 2**32 - 1)
# Reset the random seed to ensure randomness in subsequent calls
random.seed()
return (text, random_seed)