Sample code for 30+ languages & platforms
PHP ActiveX

Generating Random Integer in Range

See more PRNG Examples

Demonstrates how to generate random integers in a specified range.

Chilkat PHP ActiveX Downloads

PHP ActiveX
<?php

$success = 0;

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

$success = 0;

$fortuna = new COM("Chilkat.Prng");

// Generate random integers between 12 and 24 inclusive

for ($i = 0; $i <= 100; $i++) {
    print $fortuna->RandomInt(12,24) . "\n";
}


?>