• PHP Video Tutorials

PHP - Stats Rand Get Seeds() Function



Definition and Usage

The stats_rand_get_seeds() function can get the seed values of random number generator.

Syntax

  array stats_rand_get_seeds( void )

Return Values

The stats_rand_get_seeds() function can return the current seed values of the random number generator.

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, we get the seed values of random number generator.

<?php
   stats_rand_setall(10, 20);
   $sd = stats_rand_getsd();
   echo $sd[0], "<br>";
   echo $sd[1];
?>

Output

This will produce following result −

10
20
Advertisements