PHP srand() Function
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