Sunday, December 9, 2007

SIMPLE CODES

1. This uses the Rnd function to generate a random integer value in the range from 1 to 6.This example uses the Rnd function to generate a random integer value in the range from 1 to 6.

Visual Basic (Declaration)
Public NotInheritable Class VBMath


Visual Basic (Usage)
Dim instance As VBMath

' Initialize the random-number generator.
Randomize()'
Generate random value between 1 and 6.
Dim value As Integer = CInt(Int((6 * Rnd()) + 1))