Query: srand
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
SRAND(3) 1 SRAND(3) srand - Seed the random number generatorSYNOPSISvoid srand ([int $seed])DESCRIPTIONSeeds the random number generator with $seed or with a random value if no $seed is given. Note As of PHP 4.2.0, there is no need to seed the random number generator with srand(3) or mt_srand(3) as this is now done automati- cally.PARAMETERSo $seed - Optional seed valueRETURN VALUESNo value is returned.CHANGELOG+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 4.2.0 | | | | | | | The $seed becomes optional and defaults to a | | | random value if omitted. | | | | +--------+---------------------------------------------------+EXAMPLESExample #1 srand(3) example <?php // seed with microseconds function make_seed() { list($usec, $sec) = explode(' ', microtime()); return (float) $sec + ((float) $usec * 100000); } srand(make_seed()); $randval = rand(); ?>SEE ALSOrand(3), getrandmax(3), mt_srand(3). PHP Documentation Group SRAND(3)
Related Man Pages |
---|
srand(3c) - opensolaris |
rand(3) - osx |
rand_r(3c) - sunos |
srand(3) - php |
mt_srand(3) - php |