Created
December 12, 2017 16:05
-
-
Save DevanR/8aba3ae9c97398ca57f3c9dd9b749c6e to your computer and use it in GitHub Desktop.
Function to generate random strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate_random_string(chars=string.ascii_uppercase + string.digits): | |
""" | |
Generates a random string for input testing. | |
Ref: https://stackoverflow.com/questions/2257441/random-string-generation-with-upper-case-letters-and-digits-in-python | |
""" | |
size=random.randint(1, 10) | |
return ''.join(random.choice(chars) for _ in range(size)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment