function num = findNewNum(x,a,b)
% FINDNEWNUM finds new random number between a and b that doesn't appear in the array x

found = 0;                                   % so far we have not found a new number

while found ==0
    num = fix(rand*(b-a)+a); % get new random number
    same = 0;                                 % assume the number does not exist in array x
    for i = 1 :numel(x)             % go through array x to check if num is in it
     if x(i)== num                       % if it is
           same = 1;                          % change assumption
           break;                              % stop checking this number
     end
    end
   if same == 0                          % for loop is done, if we found a new number
              found =1;                     % indicate that we found a new number 
   end
   end
return
end