<?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();
var_dump($mtsrnd01);
?>
<?php
$seed02 = 100;
$mode = mt_rand(0, 1);
// MT_RAND_MT19937 = 0;
// MT_RAND_PHP = 1
$mtsrnd02 = mt_srand($seed02);
var_dump($mtsrnd02);
?>