(Visual FoxPro) Generating Random Integer in Range
Demonstrates how to generate random integers in a specified range.
LOCAL loChilkatGlob
LOCAL lnSuccess
LOCAL loFortuna
LOCAL i
* 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')
loChilkatGlob = CreateObject('Chilkat.Global')
lnSuccess = loChilkatGlob.UnlockBundle("Anything for 30-day trial.")
IF (lnSuccess <> 1) THEN
? loChilkatGlob.LastErrorText
RELEASE loChilkatGlob
CANCEL
ENDIF
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Prng')
loFortuna = CreateObject('Chilkat.Prng')
* Generate random integers between 12 and 24 inclusive
FOR i = 0 TO 100
? STR(loFortuna.RandomInt(12,24))
NEXT
RELEASE loChilkatGlob
RELEASE loFortuna
|