import random


def choose_words(database_words, word_count):
    """Randomly selects words based on the given word count. Returns
    all words in a shuffled order if no word count is specified."""

    if word_count is None:
        words = database_words 
        random.shuffle(words)

        return words

    return random.sample(database_words, word_count)