## Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today. # Are we looking to generate random numbers between the upper and lower numbers and including the upper and lower number?

I might be wrong but my understanding is we're looking to generate numbers "between" two values (an upper and lower number). If I designate an upper and lower number, say (100, 95), I was assuming I'd get 96,97,98, and 99. But the code also gives me 95 and 100 as well. How, can we modify the code to generate only the numbers between two values? May bad. Here is the code:

function getRandomNumber( lower, upper ) {

return Math.floor(Math.random() * (upper - lower + 1)) + lower; }

console.log( getRandomNumber( 'nine', 24 ) );

console.log ( getRandomNumber( 95, 100 ) );

console.log( getRandomNumber( 200, 'five hundred' ) );

console.log( getRandomNumber( 1000, 20000 ) );

console.log( getRandomNumber( 50, 100 ) ); If you want some insight on how this line of code works, i suggest looking at this answer by Jason Anello https://teamtreehouse.com/community/mathfloor-mathrandom-max-min-1-min-explanation

```function getRandomNumber(lower, upper) {
return Math.floor(Math.random() * (upper - lower - 1)) + lower + 1;
}
console.log(getRandomNumber(95, 100));
``` ```    return Math.floor(Math.random() * (upper - lower - 1)) + lower + 1;