function s=sample(x,n)
%takes a sample of size n with replacement from the vector x
s=unidrnd(length(x),1,n);
s=x(s);