<?php
void mt_srand ( int $seed = 0, int $mode = MT_RAND_MT19937 )
where,
$seed = Arbitrary INTEGER value to be used as seed
$mode = CONSTANT to specify the implementation
of the algorithm to be used
( SEE the below TABLE )
?>
CONSTANT | VALUE | DESCRIPTION |
MT_RAND_MT19937 | 0 | Uses the fixed, correct, Mersenne Twister implementation. Available as of PHP 7.1.0. |
MT_RAND_PHP | 1 | Uses an incorrect Mersenne Twister implementation. Used as the default up till PHP 7.1.0. This mode is available for backward compatibility. |
ed48 |
<?php
$mtsrnd01 = mt_srand(0, 0);
var_dump($mtsrnd01);
?>
<?php
$seed02 = 100;
$mode = MT_RAND_PHP;
$mtsrnd02 = mt_srand($seed02);
var_dump($mtsrnd02);
?>
<?php
$seed03 = 120;
$mode03 = 30;
$srd03 = mt_srand($seed03, $mode03);
var_dump($srd03);
?>
<?php
$srd04 = mt_srand();
var_dump($srd04);
?>