Randomize Statement
Initializes the random-number generator.Randomize [number]The number argument can be any valid numeric expression.Res
Randomize uses number to initialize the Rnd function's random-number generator, giving it a new seed value. If you omit number, the value returned by the system timer is used as the new seed value.If Randomize is not used, the Rnd function (with no arguments) uses the same number as a seed the first time it is called, and thereafter uses the last generated number as a seed value.Note   To repeat sequences of random numbers, call Rnd with a negative argument immediately before using Randomize with a numeric argument. Using Randomize with the same value for number does not repeat the previous sequence.The following example illustrates use of the Randomize statement. Dim MyValue, Response
Randomize   ' Initialize random-number generator.
Do Until Response = vbNo
   MyValue = Int((6 * Rnd) + 1)   ' Generate random value between 1 and 6.
   MsgBox MyValue
   Response = MsgBox ("Roll again? ", vbYesNo)
Loop
By MSDN

解决方案 »

  1.   

    Randomize 语句
          初始化随机数生成器。语法Randomize [number]可选的 number 参数是 Variant 或任何有效的数值表达式。说明Randomize 用 number 将 Rnd 函数的随机数生成器初始化,该随机数生成器给 number 一个新的种子值。如果省略 number,则用系统计时器返回的值作为新的种子值。如果没有使用 Randomize,则(无参数的)Rnd 函数使用第一次调用 Rnd 函数的种子值。注意 若想得到重复的随机数序列,在使用具有数值参数的 Randomize 之前直接调用具有负参数值的 Rnd。使用具有同样 number 值的 Randomize 是不会得到重复的随机数序列的。Randomize 语句示例
    本示例用 Randomize 语句初始化随机数生成器。由于忽略了数值参数, 所以 Randomize 用 Timer 函数的返回值作为新的随机数种子值。Dim MyValue
    Randomize   ' 对随机数生成器做初始化的动作。MyValue = Int((6 * Rnd) + 1)   ' 生成 1 到 6 之间的随机数值。
      

  2.   

    是一种语句,用来初始化随机数发生器(函数Rnd),如:
    Randomize用数字来初始化Rnd函数的随机数发生器,给它一个初始值。如果数字被忽略,系统时钟返回的值将被用来初始化Rnd函数
    如:
    Dim MyValue
    Randomize     '用系统时钟返回的值来初始化Rnd函数
    MyValue = Int((6 * Rnd) + 1)   ' 产生一个1~6之间的随机数
      

  3.   

    初始化,设置随机种子。
    让你每次的随机数都不一样。
    语法
    Randomize [number]
    可选的 number 参数是 Variant 或任何有效的数值表达式。
      

  4.   

    计算机中的随机数实际不是真正的随机数,它是通过选定一个数字(随机种子),然后再通过一个特定的算法生成一个伪随机数列。randomize实际上就是设定这个随机种子。