title: print random characters without repeat in square?
body: <p>I'm generating random characters via my code below:</p>
  
  <pre><code>static void printRandomWhatEver(int NUMBER_OF_CHARACTER,
                                  int NUMBER_OF_LINES,
                                  char char1, char char2) {
      int DIFFERENCE_SQUARE = 4;
      char oldChar, newChar, random;
      for (int i = 0; i &lt; NUMBER_OF_CHARACTER; i++) {
          random = getRandomCharacter(char1, char2);
          if ((i + 1) % NUMBER_OF_LINES == 0) { // new line each new NUMBER_OF_LINE
              System.out.println(random);
          } else {
              System.out.print(random);
          }
      }
  
  }
  </code></pre>
  
  <p>My getReandomCharacter:-</p>
  
  <pre><code>private static char getRandomCharacter(char ch1, char ch2) {
      return (char) (ch1 + Math.random() * (ch2 - ch1 + 1));
  }
  </code></pre>
  
  <p>All working fine, what i need is the <code>chars</code> inside square 2*2 numbers to not be <strong>equal</strong>, here is image to explain what i need.</p>
  
  <p><a href="https://i.stack.imgur.com/YSMQv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YSMQv.png" alt="enter image description here"></a></p>
  
  <p>The digit <em>4</em> is in the same square:-</p>
  
  <pre><code>**
  **
  </code></pre>
  
  <p>How i can prevent digits to be equal in a part of square?</p>
  
  <p>Thanks in advance.</p>