srand
(PHP 4, PHP 5, PHP 7, PHP 8)
Seed the random number generator
Description
Seeds the random number generator with seed or with a random value if no seed is given.
Randomseed Mt19937-tiny-seed
As of PHP 7.1.0, srand() has been made an alias of mt_srand().
Parameters
seedFills the state with values generated with a linear congruential generator that was seeded with
seedinterpreted as an unsigned 32 bit integer.If
seedis omitted or null, a random unsigned 32-bit integer will be used.
Return Values
Void
Changelog
| Version | Description |
|---|---|
| 8.3.0 | seed is now nullable. |
| 7.1.0 | srand()has been made an alias of mt_srand(). |