import random
import string


def garble(in_string, letter=None):
    """Replaces a random character in_string with another letter.

    Could complicate naive cryptanalysis, so useful for generating test
    cases."""
    if letter is None:
        letter = random.choice(string.ascii_uppercase)
    idx = random.randint(0, len(in_string) - 1)
    return in_string[:idx] + letter + in_string[idx+1:]