function OMEGA = WS_SW(N,K,beta)
OMEGA = zeros(N,N);
DNOT = zeros(N,1);
DNOT(1:K/2) = 1;
DNOT(K/2+2:K+1) = 1;
icon = [K/2+2:K+1];
inot = [K+1:N];
for i =1:N
% OMEGA(i,:) = circshift(OMEGA(1,:),i-1);
% inot = find(OMEGA(i,:)>0);
NR = sum(rand(K/2,1)<beta);
i1 = randperm(length(icon),NR);
i2 = randperm(length(inot),NR);
QNOT = DNOT;
QNOT(icon(i1)) = 0;
QNOT(inot(i2)) = 1;
% dnot = randperm(
% ynot = randperm(N); %create a permutation of size N
% OMEGA(i,1:K/2) = QNOT(1:K/2);
% OMEGA(i,K/2+2:K+2) = QNOT(K/2+1:K);
OMEGA(i,:) = circshift(QNOT,i-K/2-1);
end
%%
end