Problem with rng shuffle
이전 댓글 표시
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 ?
채택된 답변
추가 답변 (2개)
Sean de Wolski
2015년 2월 25일
0 개 추천
Why do you want to reset the stream on each iteration? This will be slow. The stream is random, so just set it once at the beginning of the run.
Chuck
2016년 5월 5일
0 개 추천
I have noticed this too. Even if you do not shuffle in every generation and shuffle it once, it will be slower than rng("default"). Of course, it might be unnoticeable depending on your code.
But... We do not know the nature of your iterations. If you are using parallelization (e.g. parfor), than you need to do rng("shuffle") right after the parfor definition line. Otherwise, after each individual for loop is done, it goes back go rng("default").
If your iterations are not using parallelization, then you should be fine by just adding that at the beginning of your code.
댓글 수: 1
NEELU GUPTA
2019년 2월 24일
Sir, How and why we use rng(shuffle), I am trying to calculate average of 2000 iterations using random number
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!