Sample code for 30+ languages & platforms
VBScript

Generating Random Integer in Range

See more PRNG Examples

Demonstrates how to generate random integers in a specified range.

Chilkat VBScript Downloads

VBScript
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

success = 0

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

success = 0

set fortuna = CreateObject("Chilkat.Prng")

' Generate random integers between 12 and 24 inclusive

For i = 0 To 100
    outFile.WriteLine(fortuna.RandomInt(12,24))
Next

outFile.Close