How to use mt srand in PHP

This article describe about mt_srand() Function in PHP.
  • 1509

mt_srand() Function

The function random number generator mt_rand() is seeds mt_srand() function.

The mt_srand() must be called before any calls to mt_rand() but must be called only once per script.

Syntax

mt_srand(seed)

 

Parameter Description
seed Optional. seed no for random number generator. if skip then

a random value is used

Example

<html>
<body>
<?php
mt_srand(mktime());
echo(mt_rand());
?>
</body>
</html>

 

Output


mt-srand-php.jpg

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.