clc clear all %% A program to generate unique lotto numbers % This program works with the while statement xlow=1; xhigh=59; n=6; i=1 while i<=n lottopick(i)=floor(xlow+(xhigh-xlow+1)*rand); flag=0 for j=1:1:i-1 if (lottopick(i)==lottopick(j)) flag=1 end end if flag==0 i=i+1 end end lottopick