Skip to content

Instantly share code, notes, and snippets.

@madrugado
Created February 16, 2018 14:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madrugado/4ae6aa358b8d94be384ac124c37892a4 to your computer and use it in GitHub Desktop.
Save madrugado/4ae6aa358b8d94be384ac124c37892a4 to your computer and use it in GitHub Desktop.
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