MATLAB: Problem with rng shuffle

rngshuffle

Hello everyone, I am running my simulation for like 50000 iterations but when i use
rng('shuffle')
during each iteration, the processing speed of my computer gets very slow. I want to understand that why this one line of code has so much effect on my computer ?

Best Answer

As Sean said, don't reset the random number generator in a loop. There's no good reason to do it. You are NOT making your random number "more random", and in fact, you are likely making them less random in very complicated ways. DON'T DO THIS. I can't say that strongly enough.
'shuffle' pauses for .01s each time you call it to ensure that it uses a new seed that's different than the last time you called it. That's why it's slowing down your code.