VbMath Module (Visual Basic)

The VbMath module contains procedures used to perform mathematical operations.

Remarks

This module supports the Visual Basic language keywords and run-time library members for generating random numbers.

Members

Randomize

Rnd

 

 

Example

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

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

See Also

Reference

Math Summary

Derived Math Functions (Visual Basic)

Keywords and Members by Task

Visual Basic Language Keywords

Visual Basic Run-Time Library Members

Keywords Compared in Different Languages