AND, no offense intended, but this doesn't make a lot of sense to me.
I suspect you know the following: randn draws from a standard normal distribution, which has zero mean. Any finite set of independent values drawn from that distribution will, with probability 1, have a non-zero sample mean. But that's their sample mean, not the mean of the distribution that they are drawn from. This is exactly what you should expect when drawing independent values from a normal distribution. It is not in any sense a "strange behavior".
You probably also know most of the following: If you want a finite set of "normal-like" values that has zero mean, then the simplest thing is to generate however many values you need, and subtract their mean. Another possibility is what's called antithetic sampling, where for each value that you draw from randn, you also use its negative. You can get that using the Antithetic property of the gloabl RandStream object. Both of these create what are most definitely not independent draws from a normal distribution. They are constrained dependent draws.
You say you cannot do that, and that you need "a method that allows me to use them efficiently in the loop". I'm going to have to guess that the reason is one of two things:
1) You are generating your values one at a time. I won't get into the efficiency issues that that raises, but unless you're generating hundreds of millions of values, you should be able to call randn once to generate a vector of however many values you need, subtract off its mean, and draw from that vector in your loop. Equivalently, you could read and save the generator state, generate a large vector and save its mean, then reset the generator state and draw numbers one at a time, subtracting off the mean that you previously saved.
2) You don't know in advance how many loop iterations you will have. If that's the case, then I think you are asking for the impossible. The only way that you can expect to draw random values and maintain a sample mean of zero at all steps is to draw only zeros.
You have not said why you care about a zero mean. Perhaps that would make things more clear.
Best Answer