fixed random number generation with proper equation

This commit is contained in:
2025-08-14 12:12:07 -04:00
parent 419c6e0c99
commit 1e7c99c9b6

View File

@@ -15,6 +15,7 @@ if ( Number.isInteger(promptInt) && Number.isInteger(promptIntHigh) ) {
// Use Math.random() and the user's number to generate a random number
const resultNumber = Math.floor(Math.random() * promptIntHigh) + promptInt;
const resultNumber = Math.floor( Math.random() * (promptIntHigh - promptInt + 1) ) + promptInt;
// Create a message displaying the random number