# How to draw (random or with certain chance) multiple elements from a set where the element must not be equal to each other

2 views (last 30 days)
Romy Schipper on 6 Jun 2017
Commented: Romy Schipper on 6 Jun 2017
n = 10
m = 3
strategies = zeros(n,m)
V = [1 2 3 4 5 6]
I want to draw m numbers from V n times, where strategies(i,1) strategies(i,2) and strategies(i,3) may NOT be equal so a good solution for example strategies(i,:) = [1 6 4] bad solution = strategies(i,:) = [1 6 1] (cause there are two ones
pseudo code:
for i = 1:n
for j = 1:m
strategies(i,j) = random(V)
strategies(i,1) isnot strategies(i,2) isnot strategies(i,3)
end
end
1 3 4
4 5 6
6 1 3
3 5 6
2 1 4
etcccc
I Hope somebody can help me! (and sorry for bad englisch)
extra: if somebody know how to draw with a certain chance each element of V that would be awesome to

Andrei Bobrov on 6 Jun 2017
V = [1 2 3 4 5 6];
A = nchoosek(V,3);
strategies = A(randperm(size(A,1),10),:);

#### 1 Comment

Romy Schipper on 6 Jun 2017
thankyou so much!