English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

The mt_srand() function in PHP

The mt_srand() function provides a seed for the Mersenne Twister random number generator.

Note– PHP 4.2After version .0, the random number generator will automatically generate a seed. This feature is no longer needed now.

Syntax

mt_srand(seed)

Parameter

  • Seed-Seed Value

Returns

The mt_srand() function does not return any content.

Example

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

Output Result

1320295657