Learn how Random Numbers are generated in JavaScript:

Generating random whole numbers in JavaScript in a specific range

Generating a random number in javascript

Math.random() - JavaScript | MDN

Calculation of Number of Possible Combinations

Untitled

For all the four types of Arithmetic Questions, we can have this relation between the Upper Number ($a$) and Lower Number ($b$)

$$ a \geq b \newline

$$

<aside> ℹ️ Why not include negative numbers, where $b$ could be greater than $a$?

Because as of now, this app is created for kids of age less than 11 or 12, and negative numbers aren’t introduced to kids of that age mostly. Also, it is easier to align the numbers properly so that the question is displayed in a good format.

</aside>

We will be generating two random numbers from a range of Maximum Number ($a$) and a Minimum Number ($b$). The range will be decided on the basis of the difficulty level chosen by the user.

There are 5 Difficulty Levels ->

  1. Very Easy: Questions about numbers ranging from 1-10

  2. Easy: Questions about numbers ranging from 11-50

  3. Medium: Questions about numbers ranging from 51-100

  4. Hard: Questions about numbers ranging from 100-1000

  5. Very Hard: Questions about numbers ranging from 1000-10000

To have all the possible combinations, we need to have this range inclusive of $a$ & $b$, that is, including the Maximum & Minimum Number.

For example,

If Maximum Number $a = 8$

& Minimum Number $b = 1$

The range 1, 2, 3, 4, 5, 6, 7 or 8.