clc clear all %% A program to generate unique lotto numbers % This program gives problems xlow=1; xhigh=53; n=6; for i=1:1:n lottopick(i)=floor(xlow+(xhigh-xlow+1)*rand); for j=1:1:i-1 if (lottopick(i)==lottopick(j)) i=i-1 break; end end end lottopick