import random


def randomSchedule(j, m):
    """
    Returns a random schedule for j jobs and m machines,
    i.e. a permutation of 0^m 1^m ... (j-1)^m = (012...(j-1))^m.
    """
    schedule = [i for i in list(range(j)) for _ in range(m)]
    random.shuffle(schedule)
    return schedule