Can anyone explain it as simple as possible why is here this whole equation needed when we can simply generate random integer number by Math.floor(Math.random()) * 10?
I still can not figure it out.
My code so far
// 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) {
var randomNumber = " ";var myRandom = randomRange(5, 15);
function randomizer() { return Math.floor(Math.round()) * 10; }
if (randomNumber >= myMin && randomNumber <= myMax) {
return randomNumber; // Change this line
} else { randomizer(); }
}
// Change these values to test your function
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.2988.0 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/generate-random-whole-numbers-within-a-range