Example:
'Rnd Function Example
'The example uses the Rnd function to simulate rolling a pair of dice by
'generating random values from 1 to 6. Each time this program is run,
Sub Main ()
Dim Dice1, Dice2, Msg' Declare variables.
Dice1 = CInt(6 * Rnd() + 1)' Generate first die value.
Dice2 = CInt(6 * Rnd() + 1)' Generate second die value.
Msg = "You rolled a " & Dice1
Msg = Msg & " and a " & Dice2
Msg = Msg & " for a total of "
Msg = Msg & Str(Dice1 + Dice2) & "."
MsgBox Msg' Display message.
End Sub