Created
August 21, 2017 22:12
-
-
Save NicolleLouis/318d745bb1b7f07de4ff91fcd72b651c 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