Here are the steps in order to generate random numbers from a given range.
1st, we get a return value from the random() function. This value will be between 0.0 & 1.0.
We then multiply this value with the difference of the maximum value, & one less than the minumum value in our given range.
After that, we use the floor() function, to convert it into an integer.
Lastly, add the minimum value of our given range, to the number we came up with from above.
The code above generates a random number between 5 and 10. With 5 being our minimum, & 10 being our maximum.
Random number within an array
The code example above generates a random number between 1 and 9. Again, with 1 being our minimum, & 9 being our maximum.