← All built-ins / srand()
srand()
srand(...$args): void
Parameters
| Name | Type | Description |
|---|---|---|
| $seed | int | seed value |
Return value
Seeds rand() for reproducible sequences.
Example
srand(42); $a = rand(0, 1000); srand(42); $b = rand(0, 1000); echo $a == $b ? "reproducible" : "random";
reproducible