"Antonio Valentine" <firstname.lastname@example.org> wrote in message <email@example.com>... > Your suggestion is quite straightforward. May I ask for an option of > > A = [1:40]; > B = [10 13 22 27]; > > Then I can separate into two vectors where vector B the numbers I want to skip it. > > Is that possible? - - - - - - - - - - - - - A = 1:40; B = [10 13 22 27];
S = setdiff(A,B); r = S(randi(numel(S),n,1));
where n is the desired number of random values.
Note: This should work for any sets A and B, integer-valued or otherwise, provided their 'setdiff' is not empty.