The information in this article applies to:
SYMPTOMSIn Microsoft Excel, when you use the Randomize statement in a Visual Basic procedure to initialize the random-number generator, the Rnd function returns a different series of random numbers each time you use it in the procedure, even if you use the Randomize statement with the same number value before each Rnd function. CAUSE
The Visual Basic documentation for the Randomize statement states
that the Randomize statement uses the number argument to initialize a
random-number generator, giving it a new seed value.
WORKAROUND
To re-initialize the random-number generator, use the Rnd function
with a value of -1 to re-initialize the Rnd function, and then use
the Randomize statement with the value you want to use as the seed
value for the Rnd function. The following is an example of using this
method:
STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATION
You can use the Randomize statement to create a seed value for the Rnd
function, or initialize the Rnd function. If Randomize is not used, the
same initial seed is always used to start the sequence. REFERENCESFor more information about the Randomize Statement, choose the Search button in the Visual Basic Reference and type: RandomizeFor more information about the Rnd Function, choose the Search button in the Visual Basic Reference and type: Rnd Additional query words: 1.00 5.00c
Keywords : kbdocerr |
Last Reviewed: May 2, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |