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 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!