Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP srand() Function

PHP srand() Function

PHP Math Reference Manual PHP Math Reference Manual

Example

Seed the random number generator:

Run Example »


Definition and Usage

The srand() function seeds the random number generator (rand()).

**Tip:** Since PHP 4.2.0 the random number generator is seeded automatically, so this function is not necessary.


Syntax

srand(

seed

);

Parameters Description
seed Optional. Specifies the seed value.

Technical Details

Return Value: none.
Return Type: -
PHP Version: 4+
PHP Changelog: PHP 4.2.0: The random number generator is seeded automatically.

PHP Math Reference Manual PHP Math Reference Manual