The PHP mt_srand() function seeds the Mersenne Twister random number generator.

				
					<?php
echo(mt_srand());
?>
				
			

Syntax

				
					mt_srand()
// or
mt_srand(seed, mode)
				
			

Parameters

ParameterDescription
seedSpecifies the seed value
modeSpecifies the algorithm to use:

  • MT_RAND_MT19937 - uses the fixed, correct Mersenne Twister implementation (which is used from PHP 7.1)

  • MT_RAND_PHP - uses the incorrect Mersenne Twister implementation (which was used up to PHP 7.1)