PHP: srand() function
Description
The srand() function seed the random number generator.
Version:
(PHP 4 and above)
Syntax:
srand(num)
Parameter:
Name | Description | Required / Optional |
Type |
---|---|---|---|
num | Seed value. If omitted, a random value is used. | Optional | Integer |
Return value:
No value is returned.
Example:
<?php
srand(mktime());
echo rand();
?>
View the example in the browser
See also
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics