Lowest Random Number

Lowest Random Number
0.0 0

#1

Tell us what’s happening:
I have the correct answer here but I’m not sure how the lowest random number can ever be equal to myMin. I’m asking this because I have met the target criterion that says this it is possible.

Your code so far
function randomRange(myMin, myMax) {

return Math.floor(Math.random() * (myMax - myMin + 1)) + myMin
}

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


// 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 these values to test your function
var myRandom = randomRange(5, 15);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36 OPR/52.0.2871.64.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range


#2

What happens if Math.random() returns 0?