title: How to generate random numbers with restrictions on like numbers and powers of ten
body: <pre><code>We need to generate random numbers within a certain digit range with few restrictions 
  e.g. For double digit range 11 - 99, the resultant output should not include all like numbers [11,22,33,44,...99] and multiples of 10 [20,30,40....90]
  
  The resultant output should be [12,13,14,15,16,17,18,19,21,23,...98]
  </code></pre>
  
  <p>Note: This function should work seamlessly for other digit ranges also (e.g. 3 digit ranges spanning 101 - 999 and four digit ranges spanning 1001 - 9999)</p>
  
  <p>We are having difficulties in identifying like numbers (e.g 11, 22, 33, 44, 55, 66, 77, 88, 99, 111, 222, 333, ...., 3333 ...)</p>
  
  <p>EDIT1:</p>
  
  <pre><code>protected static List&lt;Integer&gt; fetchRandIntegers(int min, int max, int howMany, boolean randomize) {
  
      // We need to reverse minimum, maximum values for negative ranges
      if (min &gt; max) {
          int tmp = min;
          min = max;
          max = tmp;
      }
  
      List&lt;Integer&gt; allNumbers = new ArrayList&lt;Integer&gt;();
      for (int i = min; i &lt;= max; i++) {
          allNumbers.add(i);
      }
  
      if (randomize) {
      ...
      }
  
      return allNumbers;
  </code></pre>
  
  <p>}</p>