mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-12-18 01:00:15 +00:00
Merge pull request #34 from edawine/patch-1
Add another randomness into the password generator
This commit is contained in:
commit
cebbf567ec
|
@ -1,13 +1,14 @@
|
||||||
import string
|
import string
|
||||||
from random import *
|
import random
|
||||||
|
|
||||||
letters = string.ascii_letters
|
letters = [letter for letter in string.ascii_letters]
|
||||||
digits = string.digits
|
digits = [digit for digit in string.digits]
|
||||||
symbols = string.punctuation
|
symbols = [symbol for symbol in string.punctuation]
|
||||||
chars = letters + digits + symbols
|
chars = letters + digits + symbols
|
||||||
|
random.shuffle(chars)
|
||||||
|
|
||||||
min_length = 8
|
min_length = 8
|
||||||
max_length = 16
|
max_length = 16
|
||||||
password = ''.join(choice(chars) for x in range(randint(min_length, max_length)))
|
password = ''.join(random.choice(chars) for x in range(random.randint(min_length, max_length)))
|
||||||
print('Password: %s' % password)
|
print('Password: ' + password)
|
||||||
print('[ If you are thinking of using this passsword, You better save it. ]')
|
print('[ If you are thinking of using this passsword, You better save it. ]')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user