Tell us what’s happening:
// running tests
The lowest random number that can be generated by randomRange should be equal to your minimum number, myMin.
The highest random number that can be generated by randomRange should be equal to your maximum number, myMax.
// tests completed
Your code so far
// Only change code below this line.
function randomRange(myMin, myMax) {
var maxNumber = Math.max(myMin, myMax);
var minNumber = Math.min(myMin, myMax);
return Math.floor(Math.random() + (minNumber)) - maxNumber; // Change this line
}
// Change these values to test your function
var myRandom = randomRange(5, 15);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range/