Gets a random post from a subreddit and returns a title and shortlink to it.

def random_post(subreddit, apikey):
    """Gets a random post from a subreddit and returns a title and shortlink to it."""
    subreddit = '/r/random' if subreddit is None else '/r/%s' % subreddit
    urlstr = 'http://reddit.com%s/random?%s' % (subreddit, time.time())
    url = get(urlstr, headers={'User-Agent': 'CslBot/1.0'}).url
    return '** %s - %s' % (get_title(url, apikey), get_short(url, apikey))