Created
February 16, 2018 14:36
-
-
Save madrugado/4ae6aa358b8d94be384ac124c37892a4 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
from random import random, choice | |
def noise_generator(string, noise_level, chars): | |
noised = "" | |
for c in string: | |
if random() > noise_level: | |
noised += c | |
if random() < noise_level: | |
noised += choice(chars) | |
return noised |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment