# VB6 - Random Integer



## asbo (Sep 21, 2001)

I hate to ask such a newbie-ish question, but how do you generate a random interger in Visual Basic 6? I've already tried:

Math.Randomize (RndmIntOut)
Math.Rnd (RndmIntOut)
RndmIntOut = Math.Randomize
RndmIntOut = Math.Rnd

None seemed to work, all of them returned errors... If ya need those for some reason, lemme know...

Thanks.


----------



## Mosaic1 (Aug 17, 2001)

This will print a random int between 1 and 100 on Form1 each time the command button is clicked. 



Private Sub Command1_Click()
Dim intWhatever As Integer
intWhatever = Int((100 * Rnd) + 1) 
Cls
Form1.Print intWhatever

End Sub


----------



## asbo (Sep 21, 2001)

Thanks, figured it must be something simple... =)


----------

