PHP mt_srand() Function

Definition

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

Syntax

PHP mt_srand() Function has the following syntax.

mt_srand(seed);

Parameter

ParameterIs Required Description
seedOptional. Seed value

Return

None

Example

Seed the random number generator:


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

The code above generates the following result.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions