On this lesson you're trying to generate a random number between min and max that includes both these values. However, the min value never gets generated with the code you have:
Lines 427 to 430 in 4a64f00
For results to include both min and max value you should replace:
Math.floor(Math.random() * (max - min) + 1) + min;
Math.floor(Math.random() * (max + 1 - min) + min);
The issue seems to be that for
randomInt(10, 20) you're multiplying the random number by 10
(max - min) and then always adding 1 to it, ensuring that the lowest possible outcome will always be at least 1 above the min value and that the possible outcomes range from 11 to 20 (10 values).
Instead you should be multiplying the random number by 11
(max + 1 - min) so that the range of possible outcomes ranges from 10 to 20 (11 values) and thus includes both min and max values.
Hope this helps and thanks for creating this course. I'm really enjoying it!
|Issue Title||Created Date||Updated Date|