a = [1, 2, 3, 4]
b = [5, 6, 7, 8, 9]
ratio = float(len(a)) / float(len(a) + len(b))
c = [(not a and b.pop(0) or not b and a.pop(0) or random.random() < ratio and
    b.pop(0) or a.pop(0)) for _ in range(len(a) + len(b))]
Randomly Interleave 2 Arrays In Python