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
srand(3c) - opensolaris
rand(3) - osx
rand_r(3c) - sunos
srand(3) - php
mt_srand(3) - php
Similar Topics in the Unix Linux Community
KKTechGameMaster: μRndDice (j2meKKTechRndDice) 1.0.2
The Digital Seed Vault dev-20081209 (Default branch)
Need specialized random string generator script
Random selection of subset of sample from file
awk (or) UNIX random RGB colors generator?