Skip to content

Instantly share code, notes, and snippets.

@Dhrumilcse
Created September 19, 2018 15:58
Show Gist options
  • Save Dhrumilcse/78a56a7cfa8123f8934271ada0aeabff to your computer and use it in GitHub Desktop.
Save Dhrumilcse/78a56a7cfa8123f8934271ada0aeabff to your computer and use it in GitHub Desktop.
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