Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. def chooseOneLetter(base1, base2):
  2. ratio = 10
  3. seed = int(random.uniform (0, ratio*len(base1)+len(base2)))
  4. if seed < ratio*len(base1):
  5. #print("SIAL1")
  6. #print(int(seed/ratio))
  7. chosenLetter = base1[int(seed/ratio)]
  8. base1.remove(chosenLetter)
  9. else:
  10. #print("SIAL2")
  11. #print(seed - ratio*len(base1))
  12. chosenLetter = base2[(seed - ratio*len(base1))]
  13. base2.remove(chosenLetter)
  14. return chosenLetter
  15.  
  16. def getSecretCode(base1, base2):
  17. #print("new run")
  18. secretCode = ""
  19. for i in range(4):
  20. chosenLetter = chooseOneLetter(base1, base2)
  21. secretCode += chosenLetter
  22. return secretCode
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement