The randomInt() function implemented is not valid for this use case. The function is shown below:
As per W3Schools this generates a random number between min and max (BOTH INCLUDED), which is causing the issue.
Since both min and max can be included, the code is crashing of index out of bounds error sometimes while testing, when the randomInt() returns max. A sample screenshot is given below:
Bug Description
The
randomInt()
function implemented is not valid for this use case. The function is shown below:As per W3Schools this generates a random number between
min
andmax
(BOTH INCLUDED), which is causing the issue.Since both
min
andmax
can be included, the code is crashing of index out of bounds error sometimes while testing, when therandomInt()
returnsmax
. A sample screenshot is given below: