function r=ranBinVec(len,n1);
%
% r=ranBinVec(len,n1) 
% returns vector of length len with n1 ones at random possition
%

r=zeros(len,1);
flag=zeros(len,1);

i=1;
while i<=n1;
    ind=floor(len*rand)+1;
    if flag(ind)==0;
        r(ind)=1;
        flag(ind)=1;
        i=i+1;
    end
end