Skip to content

Instantly share code, notes, and snippets.

@Yepoleb
Last active November 15, 2019 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yepoleb/768e4df57a78a3d1748241c6eb437363 to your computer and use it in GitHub Desktop.
Save Yepoleb/768e4df57a78a3d1748241c6eb437363 to your computer and use it in GitHub Desktop.
import random
import string
vowels = "aeiou"
consonants = list(set(string.ascii_lowercase) - set(vowels))
def subify(subi):
base_subi = list(subi)
r = random.random()
if r <= 0.3:
change = 1
else:
change = 2
for _ in range(change):
character_i = random.randrange(0, len(base_subi))
if base_subi[character_i] in vowels:
choose_set = vowels
else:
choose_set = consonants
base_subi[character_i] = random.choice(choose_set)
return "".join(base_subi)
for _ in range(20):
print(subify("subi"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment