how do I randomize calls to functions
like will
randomize
call function1
call function2
call function3
work?
Printable View
how do I randomize calls to functions
like will
randomize
call function1
call function2
call function3
work?
Try this:
Code:Private Sub Command1_Click()
Randomize
retVal = Int((3 * Rnd) + 1)
If retVal = 1 Then Call function1
If retVal = 2 Then Call function2
If retVal = 3 Then Call function3
End Sub
thanks
You could also do a select case without having to store the returned value
[code]
Randomize
select case Int(3 * Rnd)
case 0
Call function1
case 1
Call function2
case 2
Call function3
end select
[code]