php man page for srand

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 generator

SYNOPSIS
void srand ([int $seed])
DESCRIPTION
Seeds 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.
PARAMETERS
o $seed - Optional seed value
RETURN VALUES
No value is returned.
CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 4.2.0 | | | | | | | The $seed becomes optional and defaults to a | | | random value if omitted. | | | | +--------+---------------------------------------------------+
EXAMPLES
Example #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 ALSO
rand(3), getrandmax(3), mt_srand(3). PHP Documentation Group SRAND(3)
Related Man Pages
rand_r(3c) - opensolaris
sranddev(3) - mojave
rand_r(3c) - sunos
sranddev(3) - osx
srand(3) - osx
Similar Topics in the Unix Linux Community
PHP: at mm:ss.00
Question on Ramdom Number
How to remove the lines from file using perl
How to remove the specific lines from file using perl
Random selection of subset of sample from file