I did not think about it earlier, but I think it is wrong to use the same Binomial(n,p) for all the nodes. Instead, we need a new Binomial(n-1-source, p) for each iteration inside the loop and take 1 sample value from this new binomial. That would be the equivalent to the loop in the old code which does a Bernoulli sample for each of (n-1-source) nodes inside the loop.