Seed the random number generator in PHP

Description

The following code shows how to seed the random number generator.

Example


  // w  ww .j a  v  a  2s  .  c o m
<?php
    srand(mktime());
    echo(rand());
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Development »




Environment
Error
Hash
Include
Locale
Math
Network
Output
Reflection
PHP Regular Expressions