title: Trying to randomly generate a binary number from 000 to 110
body: <p>I have code that randomly generates a binary number from 000 to 111 but I'm having trouble having it create a number from 000 to <strong>just 110</strong>. I know that I can somehow rerun the code everything it comes out with 111 but I can't seem to figure out the way to have it do that.</p>
  
  <pre><code>public String binNumber() {
          StringBuilder storage = new StringBuilder();
          int i = 0;
          while (i &lt; 3) {
              int binny = this.giveMeBinary();
              storage.append(String.valueOf(binny));
  
              i++;
          }
  
  
          return storage.toString();
      }
  
  public int giveMeBinary() {
          Random rg = new Random();
          int bin = rg.nextInt(2);
          return bin;
  
      }
  </code></pre>