Skip to content

Commit

Permalink
refactor: use hashset
Browse files Browse the repository at this point in the history
  • Loading branch information
ni-jessica committed Oct 16, 2023
1 parent 0154168 commit 1f4ef9a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backend/database/generatePasswords.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
since when presented with these requirements, most users choose 1 special character and fill in the rest of the characters with letters and digits. Writes to passwords to a csv file.
'''
passwords, i = [], 0
passwords, i = set(), 0

while i < 20:
# meet requirements:
password = random.choice(string.ascii_lowercase) # select 1 lowercase
Expand All @@ -31,7 +32,7 @@
password = ''.join(password_list)

if password not in passwords:
passwords.append(password)
passwords.add(password)
i += 1

# write to csv file
Expand Down

0 comments on commit 1f4ef9a

Please sign in to comment.