fixed random number generation with proper equation
This commit is contained in:
@@ -15,6 +15,7 @@ if ( Number.isInteger(promptInt) && Number.isInteger(promptIntHigh) ) {
|
|||||||
// Use Math.random() and the user's number to generate a random number
|
// 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;
|
||||||
|
const resultNumber = Math.floor( Math.random() * (promptIntHigh - promptInt + 1) ) + promptInt;
|
||||||
|
|
||||||
// Create a message displaying the random number
|
// Create a message displaying the random number
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user