Pythonic split list into n random chunks of roughly equal size
import random

def chunk(xs, n):
    ys = list(xs)


Copies of lists are usually taken using xs[:]

    random.shuffle(ys)
    ylen = len(ys)


I don't think storing the length in a variable actually helps your code much

    size = int(ylen / n)


Use size = ylen // n // is the integer division operator

    chunks = [ys[0+size*i : size*(i+1)] for i in xrange(n)]


Why the 0+? 

    leftover = ylen - size*n


Actually, you can find size and leftover using size, leftover = divmod(ylen, n)

    edge = size*n
    for i in xrange(leftover):
            chunks[i%n].append(ys[edge+i])


You can't have len(leftovers) &gt;= n. So you can do:

   for chunk, value in zip(chunks, leftover):
       chunk.append(value)


    return chunks


Some more improvement could be had if you used numpy. If this is part of a number crunching code you should look into it.