Randperm generating the same sequence of permutation
조회 수: 6 (최근 30일)
이전 댓글 표시
I am using randperm to generate different random permutations (subset of the data) from a data set. However even after 2 iterations it is generating the same combination of the number. For eg: the desired output would be like p={1,3,5,6,9,10},{4,6,7,2,1,3}... however i am getting p={1,4,5,7,8},{1,4,5,7,8}. its the same sequence i am getting.
saikath
댓글 수: 0
답변 (2개)
Azzi Abdelmalek
2015년 6월 17일
편집: Azzi Abdelmalek
2015년 6월 17일
for k=1:3
out{k}=randperm(10,5)
end
celldisp(out)
James Tursa
2015년 6월 17일
Are you resetting the random number generator in between iterations?
댓글 수: 4
Guillaume
2015년 6월 17일
You can use two different RandStream, one for the random sequence generation, one for randperm.
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with Statistics and Machine Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!