Effacer les filtres
Effacer les filtres

Which algorithm performs random shuffling of data in Matlab (randperm function)?

2 vues (au cours des 30 derniers jours)
I would like to know Which algorithm performs random shuffling of data in Matlab (randperm function) . Is it Knuth shuffling algorithm or something else?

Réponse acceptée

David Sanchez
David Sanchez le 7 Mai 2013
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

Plus de réponses (0)

Catégories

En savoir plus sur Random Number Generation dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by