I am looking for a highperformance Python solution to the following problem:
Flip a biased coin n times so that the probability of heads (=1) is
equal to a given probability p. n is in the millions.
numpy
You are looking for the NumPy builtin np.random.choice

np.random.choice([1,0],n,p=[p,1p])
Let's verify 
In [120]: p = 0.8
In [121]: n = 100000
In [122]: (np.random.choice([1,0],n,p=[p,1p])==1).mean()
Out[122]: 0.80003999999999997
Looks pretty efficient too 
In [123]: %timeit np.random.choice([1,0],n,p=[p,1p])
100 loops, best of 3: 4 ms per loop