I am trying to perform disorder averaging over different realizations of a lattice with some of the nodes randomly thrown away.
Specifically, consider the following model: we have a lattice (graph) with N nodes. Then each of the nodes is thrown away with probability p. Realization of the lattice is represented as a vector of N zeros and ones, where each of the components is a random variable drawn from Bernoulli distribution (probablity p for zero and (1-p) for one). Then I need to average some quantity over this random vectors.
I’ve tried to generate random vectors with a simple bruteforce method
vec = [rand()<p for i in 1:N].
But, it seems, that the set of vectors generated this way converges too slowly to the desired distribution.
Can someone advise me with a more efficient way to generate random vectors of independent Bernoulli variables? The computation for each of the vectors takes about 100 seconds, so I don’t care if the generation takes a couple of seconds. But the number of runs is the problem, so I need to speed up satistical convergence.