(VBScript) Generating Random Integer in Range
Demonstrates how to generate random integers in a specified range.
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
' All Chilkat classes can be unlocked at once at the beginning of a program
' by calling UnlockBundle. It requires a Bundle unlock code.
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Global")
set chilkatGlob = CreateObject("Chilkat.Global")
success = chilkatGlob.UnlockBundle("Anything for 30-day trial.")
If (success <> 1) Then
outFile.WriteLine(chilkatGlob.LastErrorText)
WScript.Quit
End If
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Prng")
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
|