def generate_random_string(length=8):
    """
    Generate a random string
    """
    char_set = string.ascii_uppercase + string.digits
    return ''.join(random.sample(char_set * (length - 1), length))
def generate_random_string ( length = 8 ) : char_set = string . ascii_uppercase + string . digits return '' . join ( random . sample ( char_set * ( length - 1 ) , length ) )
Generate a random string