Demo entry 6644933

randomstringstuff

   

Submitted by kot on Oct 07, 2017 at 23:30
Language: Python 3. Code size: 472 Bytes.

import uuid

def my_random_string(string_length=10):
    """Returns a random string of length string_length."""
    random = str(uuid.uuid4()) # Convert UUID format to a Python string.
    random = random.upper() # Make all characters uppercase.
    random = random.replace("-","") # Remove the UUID '-'.
    return random[0:string_length] # Return the random string.

s = set()
while True:
    if len(s) >= 1000000:
        break
    s.add(my_random_string(5))

print(s)

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).