Sample code for 30+ languages & platforms
B4X

Generating Random Integer in Range

See more PRNG Examples

Demonstrates how to generate random integers in a specified range.

Chilkat B4X Downloads

B4X
Dim success As Boolean = False

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

success = False

Dim fortuna As ChilkatPrng
fortuna.Initialize

'  Generate random integers between 12 and 24 inclusive
Dim i As Int
For i = 0 To 100
    Log(fortuna.RandomInt(12, 24))
Next