srand

PHP 4, PHP 5, PHP 7, PHP 8
srand - Seed the random number generator

srand( [int$seed = 0], [int$mode = MT_RAND_MT19937] ): void

Seeds the random number generator with seed or with a random value if seed is 0.

Note:

There is no need to seed the random number generator with srand or mt_srand as this is done automatically.

Note:

As of PHP 7.1.0, srand has been made an alias of mt_srand.

Parameters

seed

An arbitrary int seed value.

Return Values

No value is returned.

Changelog

Version Description
7.1.0 srand has been made an alias of mt_srand.

Related Functions

Example of srand

Show all examples for srand

PHP Version:


Function srand:

Mathematical Functions Functions

Most used PHP functions