title: Generating random integer between two inputs Javascript
body: <p>I'm trying to write a function (<code>GetPositiveInteger</code>) that generates a random integer between variables <code>a</code> and <code>b</code>.  if <code>a &gt; b</code>, it's supposed to switch the values of the two so that <code>b=&gt;a</code> before generating the Number.</p>
  <p>I don't know if I'm misunderstanding the question or what because I can't figure out where I'm meant to be converting <code>a</code> and <code>b</code> to integers and my program keeps just returning <code>NaN</code>. here's my code maybe someone could take a look at it?</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function GetRandomInteger(a, b, c) {
    a = Number(a), b = Number(b);
    if (a &gt; b) {
      var a = 2,
        b = 1,
        c = a;
      a = b;
      b = c;
    } else {
      var x = parseInt(Math.random() * b) + a;
    }
  
    return x;
  }
  
  let x;
  console.log(Number(GetRandomInteger(x)));</code></pre>
  </div>
  </div>
  </p>