MATLAB: Setting seed in random (‘normal’)

MATLABrandomseed

I am using random('Normal',2,5,T,1) to generate vector of random numbers from normal distribution with mean 2, variance 5. I want to set the seed so that I can get same set of random numbers each time I run the m file. I am using matlab 7.10.0 (R2010a). I have tried with rand('seed',0) command before random('Normal',2,5,T,1) but it does not serve my purpose. Can anyone help me please?

Best Answer

In that version of MATLAB, I am pretty sure that there are separate streams for rand() and randn(). I think random('Normal',...) effectively uses randn() in its guts. So, I believe you will get what you want if you just use
>> randn('seed',0)