how do i get a randomize number?
Rnd Function Example This example uses the Rnd function to generate a random integer value from 1 to 6. Dim MyValue MyValue = Int((6 * Rnd) + 1) ' Generate random value between 1 and 6.
Code: Dim Num as Long Dim MaxRange as Long MaxRange = 2000 Num = Int(Rnd(1) * MaxRange) In this case, Num would contain a value between 0 and 2000.
Dim Num as Long Dim MaxRange as Long MaxRange = 2000 Num = Int(Rnd(1) * MaxRange)
Visual Basic 6 Enterprise Edition + SP4
nb. Use the Randomize statement before using Rnd()
Iain, thats with an i by the way!
Forum Rules