# Random Whole Numbers within a Range

Random Whole Numbers within a Range
0

#1

I have a problem with this challenge

My code

// 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);

#2

What kind of a problem? It’s workin for me:

#3

#4

why do you need this part?:

myMin = Math.ceil(myMin);
myMax = Math.floor(myMax);

Just remove it and it should work.

#5

#6

I take out. It did not pass it.

#7

Try to copy/paste this one and let me know.

// 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);

#8

I think there is a problem with freeCodeCamp verificator (parser or however it’s called).
I have similar issues with “Escaping Literal Quotes in Strings” task. It seems to be ok but site won’t accept it. Just go to next challenge.

#9

var myRandom = randomRange(5, 15); wrong
I did this
randomRange(5, 15); It is work.

Thanks.

#10

No worries, keep up the good work.