Aggiunta possibilitá di Random tra due valori

master
Michael Vignotto 2020-05-24 16:05:04 +02:00
parent 8a7269e591
commit 0a12dfc27c
2 changed files with 6 additions and 2 deletions

View File

@ -2,7 +2,11 @@ import random
import string
ALPHANUMERIC_CHARS = string.ascii_lowercase + string.ascii_uppercase + string.digits
MAX_STRING_LENGTH = 11
MIN_STRING_LENGTH = 11
MAX_STRING_LENGTH = 27
def generate_random_string(chars=ALPHANUMERIC_CHARS,length=MAX_STRING_LENGTH):
random_string_length = random.randint(MIN_STRING_LENGTH,MAX_STRING_LENGTH)
def generate_random_string(chars=ALPHANUMERIC_CHARS,length=random_string_length):
return "".join(random.choice(chars) for _ in range(length))