随机函数Randomize

Technorati 标签: Randomize, vba, 随机数

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.

  1. Randomize 
  2. lucky(t) = Int((maxNum - minNum + 1) * Rnd + minNum) 

你可能感兴趣的:(function,Random,VBA)