Sample code for 30+ languages & platforms
Visual FoxPro

Generating Random Integer in Range

See more PRNG Examples

Demonstrates how to generate random integers in a specified range.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loFortuna
LOCAL i

lnSuccess = 0

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

lnSuccess = 0

loFortuna = CreateObject('Chilkat.Prng')

*  Generate random integers between 12 and 24 inclusive

FOR i = 0 TO 100
    ? STR(loFortuna.RandomInt(12,24))
NEXT

RELEASE loFortuna