Created
September 19, 2018 15:58
-
-
Save Dhrumilcse/78a56a7cfa8123f8934271ada0aeabff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def generateAWord (length): | |
i = 0 | |
result = "" | |
while i < length: | |
letter = chr(97 + int(26 * random.random())) | |
result += letter | |
i +=1 | |
return result | |
def generateFirstPopulation(sizePopulation, password): | |
population = [] | |
i = 0 | |
while i < sizePopulation: | |
population.append(generateAWord(len(password))) | |
i+=1 | |
return population |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment