Date: Jun 23, 2013 4:54 AM
Author: Bruno Luong
Subject: Re: Random matrix of 0s and 1s with two not trivial constraints

K = 30;
k = 4;
N = 10000;
C = nchoosek(K,k);
if N > C
error('not possible')
end
itab = randperm(C,N);

J = nchoosek(1:K,k);
J = J(itab,:);

I = repmat((1:N)', [1 k]);
a = accumarray([I(:) J(:)], 1);

% Bruno