import random


def get_random_choice(word_dist):
    """
    Given a word distribution, pick one at random based on how common
    it is.

    Args:
        word_dist (FreqDist) - a frequency distribution of words
    Returns:
        string - a random word from word_dist
    """
    total_samples = word_dist.N()
    random_sample = random.randint(0, total_samples)
    running_total = 0
    # iterate over all the possible bins
    for word_bin in word_dist.most_common(word_dist.B()):
        # add the number of incidences of the current word to the total
        running_total += word_bin[1]
        # if the random number falls into the current bucket, return this word
        if random_sample <= running_total:
            return word_bin[0]