From: Rahul Goswami Date: Wed, 28 Feb 2018 20:19:14 +0000 (+0000) Subject: Update xkcd_password.py X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=1c3af6a553c8e87239055bf146b080ed468e09d0;p=redacted-XKCD-password-generator.git Update xkcd_password.py --- diff --git a/xkcdpass/xkcd_password.py b/xkcdpass/xkcd_password.py index 193bf52..abca96e 100755 --- a/xkcdpass/xkcd_password.py +++ b/xkcdpass/xkcd_password.py @@ -147,7 +147,7 @@ def wordlist_to_worddict(wordlist): # Maybe should be a defaultdict, but this reduces dependencies for word in wordlist: - if word[0] not in worddict: + if word[0] not in worddict: # replaced try-catch with if statement worddict[word[0]] = [] worddict[word[0]].append(word) @@ -205,9 +205,9 @@ def choose_words(wordlist, numwords): assert len(wordlist) > 0 if len(wordlist) >= numwords: - return rng().sample(wordlist, numwords) # ensures no duplicates + return random.sample(wordlist, numwords) # ensures no duplicates else: - return rng().choices(wordlist, numwords) # allows duplicates if wordlist is small + return random.choices(wordlist, numwords) # allows duplicates if wordlist is small def try_input(prompt, validate):