Sample code for 30+ languages & platforms
Xbase++

Generating Random Integer in Range

See more PRNG Examples

Demonstrates how to generate random integers in a specified range.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oFortuna
LOCAL i

nSuccess := 0

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

nSuccess := 0

oFortuna := CreateObject("Chilkat.Prng")

//  Generate random integers between 12 and 24 inclusive

FOR i := 0 TO 100
    ? Str(oFortuna:RandomInt(12, 24))
NEXT

oFortuna:destroy()