function s = sample_without_replacement_bis(k,I,idx)
% returns an iid sample s of k elements from [1:n]', such that it has not
% previously been sampled, i.e., such that it is not already a column
% vector of the incidence matrix I

n=size(I,1);
is_valid = 0;
while is_valid==0
    is_valid = 1;
    s = randsample([1:n]',k);
    v=zeros(n,1); v(s)=ones(k,1);
    for h=1:idx
        if I(:,h)==v
            is_valid=0;
        end          
    end
end

end