<p dir="auto">Challenge <a href="https://www.freecodecamp.com/en/challenges/basic-javascript/generate-random-whole-numbers-within-a-range" rel="nofollow">generate-random-whole-numbers-within-a-range</a> has an issue.<br>
User Agent is: <code class="notranslate">Mozilla/5.0 (X11; CrOS x86_64 8350.68.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36</code>.</p>
<p dir="auto">I and several others in the JavaScript chat page are running into an issue with this challenge; the code you can see below won't make the tests pass even though it's logically sound and seems like the obvious answer. The tests that aren't passing for me are the top two:</p>
<p dir="auto">The lowest random number that can be generated by randomRange should be equal to your minimum number, myMin.</p>
<p dir="auto">The highest random number that can be generated by randomRange should be equal to your maximum number, myMax.</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="    \ file: 
// Example
function ourRandomRange(ourMin, ourMax) {

  return Math.floor(Math.random() * (ourMax - ourMin + 1)) + ourMin;
}

ourRandomRange(1, 9);

// Only change code below this line.

function randomRange(myMin, myMax) {

  return Math.floor(Math.random() * (myMax - myMin + 1)) + myMin; // Change this line
}

// Change these values to test your function
var myRandom = randomRange(5, 15);"><pre class="notranslate">    \ file: 
<span class="pl-c">// Example</span>
<span class="pl-k">function</span> <span class="pl-en">ourRandomRange</span><span class="pl-kos">(</span><span class="pl-s1">ourMin</span><span class="pl-kos">,</span> <span class="pl-s1">ourMax</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>

  <span class="pl-k">return</span> <span class="pl-v">Math</span><span class="pl-kos">.</span><span class="pl-en">floor</span><span class="pl-kos">(</span><span class="pl-v">Math</span><span class="pl-kos">.</span><span class="pl-en">random</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">*</span> <span class="pl-kos">(</span><span class="pl-s1">ourMax</span> <span class="pl-c1">-</span> <span class="pl-s1">ourMin</span> <span class="pl-c1">+</span> <span class="pl-c1">1</span><span class="pl-kos">)</span><span class="pl-kos">)</span> <span class="pl-c1">+</span> <span class="pl-s1">ourMin</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-en">ourRandomRange</span><span class="pl-kos">(</span><span class="pl-c1">1</span><span class="pl-kos">,</span> <span class="pl-c1">9</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-c">// Only change code below this line.</span>

<span class="pl-k">function</span> <span class="pl-en">randomRange</span><span class="pl-kos">(</span><span class="pl-s1">myMin</span><span class="pl-kos">,</span> <span class="pl-s1">myMax</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>

  <span class="pl-k">return</span> <span class="pl-v">Math</span><span class="pl-kos">.</span><span class="pl-en">floor</span><span class="pl-kos">(</span><span class="pl-v">Math</span><span class="pl-kos">.</span><span class="pl-en">random</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">*</span> <span class="pl-kos">(</span><span class="pl-s1">myMax</span> <span class="pl-c1">-</span> <span class="pl-s1">myMin</span> <span class="pl-c1">+</span> <span class="pl-c1">1</span><span class="pl-kos">)</span><span class="pl-kos">)</span> <span class="pl-c1">+</span> <span class="pl-s1">myMin</span><span class="pl-kos">;</span> <span class="pl-c">// Change this line</span>
<span class="pl-kos">}</span>

<span class="pl-c">// Change these values to test your function</span>
<span class="pl-k">var</span> <span class="pl-s1">myRandom</span> <span class="pl-c1">=</span> <span class="pl-en">randomRange</span><span class="pl-kos">(</span><span class="pl-c1">5</span><span class="pl-kos">,</span> <span class="pl-c1">15</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<h4 dir="auto">Challenge Name</h4>
<p dir="auto">Generate Random Whole Numbers within a Range</p>
<h4 dir="auto">Issue Description</h4>
<p dir="auto">I think my code is correct. It meets the conditions if I log out the results to console but it will not pass the tests.</p>
<h4 dir="auto">Your Code</h4>

<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=" // Example
function ourRandomRange(ourMin, ourMax) {

return Math.floor(Math.random() * (ourMax - ourMin + 1)) + ourMin;
}

ourRandomRange(1, 9);

// Only change code below this line.

function randomRange(myMin, myMax) {

return Math.floor( Math.random() * (myMax - myMin + 1)) + myMin; // Change this line

}

// Change these values to test your function
var myRandom = randomRange(5, 15);

"><pre class="notranslate"> <span class="pl-c">// Example</span>
<span class="pl-k">function</span> <span class="pl-en">ourRandomRange</span><span class="pl-kos">(</span><span class="pl-s1">ourMin</span><span class="pl-kos">,</span> <span class="pl-s1">ourMax</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>

<span class="pl-k">return</span> <span class="pl-v">Math</span><span class="pl-kos">.</span><span class="pl-en">floor</span><span class="pl-kos">(</span><span class="pl-v">Math</span><span class="pl-kos">.</span><span class="pl-en">random</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">*</span> <span class="pl-kos">(</span><span class="pl-s1">ourMax</span> <span class="pl-c1">-</span> <span class="pl-s1">ourMin</span> <span class="pl-c1">+</span> <span class="pl-c1">1</span><span class="pl-kos">)</span><span class="pl-kos">)</span> <span class="pl-c1">+</span> <span class="pl-s1">ourMin</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-en">ourRandomRange</span><span class="pl-kos">(</span><span class="pl-c1">1</span><span class="pl-kos">,</span> <span class="pl-c1">9</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-c">// Only change code below this line.</span>

<span class="pl-k">function</span> <span class="pl-en">randomRange</span><span class="pl-kos">(</span><span class="pl-s1">myMin</span><span class="pl-kos">,</span> <span class="pl-s1">myMax</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>

<span class="pl-k">return</span> <span class="pl-v">Math</span><span class="pl-kos">.</span><span class="pl-en">floor</span><span class="pl-kos">(</span> <span class="pl-v">Math</span><span class="pl-kos">.</span><span class="pl-en">random</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">*</span> <span class="pl-kos">(</span><span class="pl-s1">myMax</span> <span class="pl-c1">-</span> <span class="pl-s1">myMin</span> <span class="pl-c1">+</span> <span class="pl-c1">1</span><span class="pl-kos">)</span><span class="pl-kos">)</span> <span class="pl-c1">+</span> <span class="pl-s1">myMin</span><span class="pl-kos">;</span> <span class="pl-c">// Change this line</span>

<span class="pl-kos">}</span>

<span class="pl-c">// Change these values to test your function</span>
<span class="pl-k">var</span> <span class="pl-s1">myRandom</span> <span class="pl-c1">=</span> <span class="pl-en">randomRange</span><span class="pl-kos">(</span><span class="pl-c1">5</span><span class="pl-kos">,</span> <span class="pl-c1">15</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
</pre></div>
<h4 dir="auto">Screenshot</h4>

<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/21320527/18397729/1c051cac-768f-11e6-9b58-8c470689492f.png"><img src="https://cloud.githubusercontent.com/assets/21320527/18397729/1c051cac-768f-11e6-9b58-8c470689492f.png" alt="image" style="max-width: 100%;"></a></p>