/* 2D Latin Hypercube of regular definition (nn x 2) */ new; cls; nn=5000; x=LH2ss1(nn); library pgraph; graphset; _plctrl=-1; xtics(0,1,0.1,0); ytics(0,1,0.1,0); xy(x[.,1],x[.,2]); proc LH2ss1(nn); local x; x=U01ss(nn)~U01ss(nn); retp(x); endp; proc U01ss(nn); local d,i,U,x,index; /* divide between 0 and 1 into n segments and sample from each segment */ d=1/nn; U=zeros(nn,1); i=1; do while i<=nn; U[i]=(d*i-d*(i-1))*rndu(1,1)+d*(i-1); i=i+1; endo; /* check if the first element is zero or not */ do while U[1]==0; U[1]=d*rndu(1,1); endo; /* randomize the order */ x=zeros(nn,1); i=1; do while i<=nn-1; index=ceil((nn-(i-1))*rndu(1,1)); x[i]=U[index]; if index==1; U=U[2:rows(U)]; elseif index==rows(U); U=U[1:rows(U)-1]; else; U=U[1:(index-1) (index+1):rows(U)]; endif; i=i+1; endo; x[nn]=U; retp(x); endp;