function x=mcrand(minVal,maxVal,minInc,maxInc)

if nargin==0,
   x=rand(1);
elseif nargin==4,
   while 1,
      x=rand(1);
      if (minInc==0) && (maxInc==1),
         if (x>minVal) && (x<=maxVal),
            break
         end
      elseif (minInc==1) && (maxInc==0),
         if (x>=minVal) && (x<maxVal),
            break
         end
      elseif (minInc==0) && (maxInc==0),
         if (x>minVal) && (x<maxVal),
            break
         end
      elseif (minInc==1) && (maxInc==1),
         if (x>=minVal) && (x<=maxVal),
            break
         end
      else
         error('Wrong inpuit parameters!')
      end
   end
else
   error('Wrong inpuit parameters!')
end
