title: How to Change 2 Math.floor random numbers if they are equal
body: <p>I'm trying to replicate the Monty Hall Problem, if you've heard of it, and I need to add in a system that will change one of two Math.floor random numbers when they are equal. My question is how do I change a variable that is random into another if it is equal to a second random variable. If you look into the Monty Hall Problem, the wrong variable would be an incorrect choice and door is correct, I set both to be random, but obviously, they cannot both be equal. This is what I have so far.</p>
  
  <pre><code>        setInterval(gr, 1000)
  
  function gr() {
       if (wrong === door) {
          door = Math.floor((Math.random() * 3) + 1);
      }
  }
  
           var door1 = 0;
  var door2 = 0;
  var door3 = 0;
  var door;
  var wrong; 
  var attempt = 0;
  
  var d1 = document.getElementById('door1');
  var d2 = document.getElementById('door2');
  var d3 = document.getElementById('door3');
  
  setInterval(gr, 1000)
  
  function gr() {
      if (wrong === door) {
      door = Math.floor((Math.random() * 3) + 1);
      }
  }
  
  function dr1() {
      document.getElementById('door1').style.pointerEvents = 'none';
      document.getElementById('door2').style.pointerEvents = 'none';
      document.getElementById('door3').style.pointerEvents = 'none';
      document.getElementById('door1').style.backgroundColor = "green";
      door1 = 1;
      if (door2 === 1) {
          document.getElementById('door2').style.backgroundColor = "black";
          door2 = 0;
      } else if (door3 === 1) {
          document.getElementById('door3').style.backgroundColor = "black";
          door3 = 0;
  }
       if (attempt === 0) {
      wrong = Math.floor((Math.random() * 2) + 1);
      door = Math.floor((Math.random() * 3) + 1);
      if (wrong === 1) {
          document.getElementById('door2').style.backgroundColor = "white";
          change1a();
  } else if (wrong === 2) {
      document.getElementById('door3').style.backgroundColor = "white";
      change1b();
        }
      }
      attempt = 1;
   }
   function dr2() {
      document.getElementById('door1').style.pointerEvents = 'none';
      document.getElementById('door3').style.pointerEvents = 'none';
      document.getElementById('door2').style.backgroundColor = "green";
      door2 = 1;
      if (door1 === 1) {
          document.getElementById('door1').style.backgroundColor = "black";
          door1 = 0;
          } else if (door3 === 1) {
          document.getElementById('door3').style.backgroundColor = "black";
          door3 = 0;
          }
          if (attempt === 0) {
      wrong = Math.floor((Math.random() * 2) + 1);
      door = Math.floor((Math.random() * 3) + 1);
      if (wrong === 1) {
          document.getElementById('door1').style.backgroundColor = "white";
          change2a();
      } else if (wrong === 2) {
          document.getElementById('door3').style.backgroundColor = "white";
          change2b();
      }
    }
      attempt = 1;
  }
  function dr3() {
      document.getElementById('door1').style.pointerEvents = 'none';
      document.getElementById('door2').style.pointerEvents = 'none';
      document.getElementById('door3').style.backgroundColor = "green";
      door3 = 1;
      if (door1 === 1) {
      document.getElementById('door1').style.backgroundColor = "black";
      door1 = 0;
      } else if (door2 === 1) {
          document.getElementById('door2').style.backgroundColor = "black";
          door2 = 0;
      }
      if (attempt === 0) {
      wrong = Math.floor((Math.random() * 2) + 1);
      door = Math.floor((Math.random() * 3) + 1);
      if (wrong === 1) {
          document.getElementById('door1').style.backgroundColor = "white";
          change3a();
      } else if (wrong === 2) {
          document.getElementById('door2').style.backgroundColor = "white";
          change3b();
      }
  }
      attempt = 1;
  }
    function change1a() {
      document.getElementById('door3').style.pointerEvents = "all";
  }
  
  function change1b() {
      document.getElementById('door2').style.pointerEvents = "all";
  }
  
  function change2a() {
      document.getElementById('door3').style.pointerEvents = "all";
  }
  
  function change2b() {
      document.getElementById('door1').style.pointerEvents = "all";
  } 
  
  }
  </code></pre>