mardi 5 novembre 2019

Random password generator function in Python

I need to create a function that generates a random password of length n, and seed s. So far i have the following:

def ran_password(n,s):
    chars = string.ascii_lowercase
    return ''.join(random.choice(chars) for x in range(n))

This creates the random password as required, but I'm not sure how to incorporate the seed within my function?

Such that when i run the function ran_password(10,123) it always prints out the same password.




Aucun commentaire:

Enregistrer un commentaire