freeCodeCamp/guide/english/certifications/javascript-algorithms-and-d.../basic-javascript/generate-random-whole-numbe.../index.md

599 B

title
Generate Random Whole Numbers within a Range

Generate Random Whole Numbers within a Range

Help for passing the final test: randomRange should use both myMax and myMin, and return a random number in your range.

You cannot pass the final test if you are only re-using the function ourRandomRange inside your randomRange formula. You need to write your own formula that uses the variables myMax and myMin. It will do the same job as using ourRandomRange, but ensures that you have understood the principles of the Math.floor() and Math.random() functions.