import random


def randint(a, b=None):
    """
    Returns a random integer in the range of [0,a] or [a,b] depending on whether b is given.
    """
    if b:
        return random.randint(a, b)
    else:
        return random.randint(0, a)