# HELP PLEASE: The highest random number that can be generated by randomRange should be equal to your maximum number, myMax

``````// 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)) + myMin;
// Change this line

}

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

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

Please include the link to the challenge if youâ€™re coming from there for help.

1 Like

Currently, your randomRange function only goes up to one less than myMax. Try adding 1 to the part which gets multiplied by Math.random().

1 Like

alriht !!! oh my yes that is rightâ€¦ thanks so much God bless you it passed.

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

Donâ€™t post your working solution please. If you do, wrap it spoiler tags.
ie:
[spoiler]
[/spoiler]

1 Like