title: Random number, which is not equal to the previous number
body: <p>I need to get random number, but it should not be equal to the previous number. Here is my piece of the code. But it doesn't work. </p>
  
  <pre><code>function getNumber(){
    var min = 0;
    var max = 4;
    var i;
    i = Math.floor(Math.random() * (max - min)) + min;
    if (i=== i) {
      i = Math.floor(Math.random() * (max - min)) + min;
    }
    return i;
  };
  
  console.log(getNumber());
  </code></pre>