Sample code for 30+ languages & platforms
Visual Basic 6.0

Generating Random Integer in Range

See more PRNG Examples

Demonstrates how to generate random integers in a specified range.

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.

success = 0

Dim fortuna As New ChilkatPrng

' Generate random integers between 12 and 24 inclusive
Dim i As Long
For i = 0 To 100
    Debug.Print fortuna.RandomInt(12,24)
Next