Sample code for 30+ languages & platforms
Lua

Generating Random Integer in Range

See more PRNG Examples

Demonstrates how to generate random integers in a specified range.

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

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

local success = false

local fortuna = chilkat.Prng.new()

-- Generate random integers between 12 and 24 inclusive
for i = 0, 100 do
    print(fortuna:random_int(12, 24))
end