The Randomize statement initializes the random number generator. The instruction Int((maxNum – minNum + 1) * Rnd + minNum) uses the Rnd function to generate a random value from the specified minNum to maxNum. The Int function converts the resulting random number to an integer. Instead of assigning constant values for minNum and maxNum, you can use the InputBox function to get these values from the user.
- Randomize
- lucky(t) = Int((maxNum - minNum + 1) * Rnd + minNum)