w3resource

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

PHP Function Reference

Previous: sqrt
Next: tan



Follow us on Facebook and Twitter for latest update.