function [d,a ] =  generate(a)

if( a.seed>0) RandStream.setDefaultStream(RandStream('mcg16807', 'Seed',a.seed));   end;

Z1=unifrnd(0,1,a.n,a.corrdim+1);
Z1_sum=Z1(:,1:end-1)+Z1(:,2:end);
Z1_cor=zeros(a.n,a.corrdim);
for i=1:size(Z1_sum,2)
    Z1_cor(:,i)=t2u(Z1_sum(:,i));
end
Z1_cor_trans=2*a.coef_r*(Z1_cor-0.5);
Z2=unifrnd(-a.coef_r,a.coef_r,a.n,a.dim-a.corrdim);
Z=[Z1_cor_trans, Z2];
Y=sign(prod(double(Z(:,1:a.corrdim)>=-a.output_r & Z(:,1:a.corrdim)<=a.output_r),2)-0.5);

d=data(Z,Y);
