Which algorithm performs random shuffling of data in Matlab (randperm function)?
조회 수: 2 (최근 30일)
이전 댓글 표시
I would like to know Which algorithm performs random shuffling of data in Matlab (randperm function) . Is it Knuth shuffling algorithm or something else?
댓글 수: 0
채택된 답변
David Sanchez
2013년 5월 7일
Try this out:
data = [1 2 3 4 5 6 7 8 9]; % your data
rand_pos = randperm(length(data)); %array of random positions
% new array with original data randomly distributed
for k = 1:length(data)
data_randomly_placed(k) = data(rand_pos(k));
end
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Random Number Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!