• PHP Video Tutorials

PHP - Stats Rand Gen Int() Function



Definition and Usage

The stats_rand_gen_int() function can generate a random integer between 1 and 2147483562.

Syntax

  int stats_rand_gen_int( void )
There is name mismatch in the actual function name and PHP manual. The actual C statement declaring the function name (stats_rand_ignlgi) and binding to the randlib.c function uses a different name as the 'proto' comment tells

Return Values

The stats_rand_gen_int() function can return a random integer between 1 and 2147483562.

Dependencies

This function was first introduced in statistics extension (PHP 4.0.0 and PEAR 1.4.0). We have used latest release of stats-2.0.3 (PHP 7.0.0 or newer and PEAR 1.4.0 or newer) for this tutorial

Example

In the following example, the function generates a random integer between 1 and 2147483562 everytime its executed.

<?php
   var_dump(stats_rand_ignlgi());
?>
Advertisements