I want to speed up the code below – namely the for loop. Is there a way to do it in numpy? More explanations – I want to generate N sequences of Bernoulli trials (ie. 0s and 1s, called throws) where each sequence has a mean (probability p) given by values in another array (mu_throws). This can be sampled from