Suppose that we have two m-files :
First one is a function :
function XX = ofx()
for i=1:2
aa = randperm(5)
end
end
Second one :
rng(0);
for i=1:2
xx = randperm(3)
end
ofx();
You can see that when we run second code again and again the outputs is the same. Why we have these same outputs in both randperm? I only want same random generator for xx random numbers not ofx function. How can i do that? How can i only use rng for a specific function?
Thanks.