Math.floor(Math.random() * (max - min 1) min)

Math.random() generates a random decimal number between 0 and 1 (exclusive of 1).

(max - min) calculates the range between the maximum value (max) and the minimum value (min).

Multiplying Math.random() by (max - min) gives a random decimal number between 0 and the range (max - min).

Adding min to the result of the previous step shifts the range to start from the minimum value (min) instead of 0.

Math.floor() rounds down the resulting decimal number to the nearest whole number, giving a random integer within the range (min, max).