Sample code for 30+ languages & platforms
Perl

Generating Random Integer in Range

See more PRNG Examples

Demonstrates how to generate random integers in a specified range.

Chilkat Perl Downloads

Chilkat2 Perl
use strict;
use warnings;
use Chilkat2;

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

my $success = 0;

my $fortuna = Chilkat2::Prng->new;

# Generate random integers between 12 and 24 inclusive
for my $i (0 .. 100) {
    print $fortuna->RandomInt(12, 24), "\n";
}