mt_srand() function in PHP


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

Note − Random number generator is seeded automatically after the release of PHP 4.2.0. This function is not needed now.

Syntax

mt_srand(seed)

Parameters

  • seed − The seed value

Return

The mt_srand() function Returns nothing.

Example

 Live Demo

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

Output

1320295657

Updated on: 26-Jun-2020

37 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements