Given the set \(v{1,2,3,5,6,7,11,12,20,21}\) how to select say \(m=5\) random numbers from it?
Matlab A = [1,2,3,5,6,7,11,12,20,21]; m = 5; B = zeros(m,1); for i = 1:m k = randi(length(A),1); B(i) = A(k); A(k) = []; end B
|
B = 2 20 7 11 1 |