I want to make a 2D array of random permutations where each row may contain a number that was generated in a previous row. But there cannot be the same number in the same row.
Is there anyway to do the following code with no for loop?
a = (1:100);
b = zeros(size(a,2), 4);
for i = 1:size(a, 2)
r = randperm(size(a, 2),4);
b(i,:) = r;
end
Aucun commentaire:
Enregistrer un commentaire