MATLAB: Difference between rng(‘shuffle’) and NO rng for estimating with MLE

3parameterdistributionestimatemlerngshufflewblfitweibul

I am trying to estimate a 3-parameter weibul distribution with random numbers. But I dont understand the difference between rng('shuffle') and NO rng('shuffle'), I mean deleting the line. Both lines estimates random numbers in my code. Can someone tell me the difference?
And if you can give me any advice for my code for estimating a 3-parameter weibul estimation, I would appreciate that.
clear all
n = 1000;
t0 = 0.5;
b_A = 1:5;
T_A = 1:5;
LowerBound= [0 0 0];
rng('shuffle');
data = zeros(n,length(b_A),length(T_A));
params = zeros(length(b_A),length(T_A));
data2P = zeros(n,length(b_A),length(T_A));
params2p = zeros(length(b_A),4,length(T_A));
for k= T_A
for i= b_A
data(:,i,k) = wblrnd(i,k, [n,1]) + t0;
data2P(:,i,k) = wblrnd(b_A(i),T_A(k), [n,1]);
start = [i k t0];
custompdf = @(x,a,b,c) (x>c).*(b/a).*(((x-c)/a).^(b-1)).*exp(-((x-c)/a).^b);
opt = statset('MaxIter',1e5,'MaxFunEvals',1e5,'FunValCheck','off');
params(i,1:3,k) = mle(data(:,i,k),'pdf',custompdf,'start',start,'Options',opt,'LowerBound',LowerBound,'UpperBound',[Inf Inf min(data(:,i,k))])
params(i,4,k) = i;
params(i,5,k) = k;
params(i,6,k) = t0;
params2p(i,1:2,k) = wblfit(data2P(:,i,k));
params2p(i,3,k) = i;
params2p(i,4,k) = k;
end
end

Best Answer

If you start a fresh instance of MATLAB, and generate a sequence of pseudorandom numbers, it will always be the same sequence. (Try it!)
If you do not use the
rng('shuffle')
then you will get the numbers from that sequence. If you do use it, then instead of traveling along that predetermined sequence of numbers, you will leap to a different point on that sequence, based on the time when you make the call to the function.