function v=scriptQ61(n,k)
%X=.5*(1+sin(pi*(rand(1,n)-.5)));
X=(-log(rand(1,n))).^2/100; % try using a squared exponential variate 
Y=cumsum(X);   Z=[];
while (Y(length(Y))>k)
i=1+sum(Y<k);
Z=[Z Y(i)-k];
Y=Y((i+1):length(Y))-Y(i);
end
v=[mean(X) mean(Z)];

