title: How to generate two different random numbers?
body: <p>I need to generate two different random numbers, they can't be equal to each other or to a third number. I tried to use a lot of if's to cover every possibility but, it seems my algorithm skills are not that good.</p>
  
  <p>Can anyone help me on this?</p>
  
  <pre><code>var numberOne = Math.floor(Math.random() * 4);
  var numberTwo = Math.floor(Math.random() * 4);
  var numberThree = 3; // This number will not always be 3
  
  if((numberOne == numberThree) &amp;&amp; (numberOne + 1 &lt; 3)) {
      numberOne++;
  } else if ((numberOne == numberThree) &amp;&amp; (numberOne + 1 == 3)) {
      numberOne = 0;
  }
  
  if ((numberOne == numberTwo) &amp;&amp; (numberOne+1 &lt; 3)) {
      if (numberOne+1 &lt; 3) {
          numberOne++;
      } else if(numberThree != 0) {
          numberOne = 0;
      }
  }
  </code></pre>
  
  <p>This is what I have so far, the next step would be:</p>
  
  <pre><code>if (numberTwo == numberThree) {
      (...)
  }
  </code></pre>
  
  <p>Is my line of thought right?
  Note: Numbers generated need to be between 0 and 3. Thanks in advance.</p>