Random numbers within a specific range

I recently came on this challenge of freeCodeCamp “Basic JavaScript: Generate Random Whole Numbers within a Range.” I know this challenge needs to be completed with the use of formula but I don’t understand it. Like what is the use of +1 in it and the last + min.
Formula :
Math.floor(Math.random() * (max - min + 1)) + min

Can someone explain how this formula works?

Think of it in this way. If you want to generate random numbers between 2 and 5, that means the four numbers (2, 3, 4, and 5) need to be possibly generated. Math.random returns values between 0 (inclusive) up to but not including 1. You must add 1 to (max - min) or you would end up not including the highest number (5). The + min gets added, so the lowest number will be min.