You are here : phpmathsrand

srand() - math

Seeds the random number generator with seed
   or with a random value if no seed is given.
Parameters :
  • seed - An arbitrary integer seed value.

  • Syntax

    void srand
         ([ int $seed
       ] )


    Example

    <?php// seed with microsecondsfunction make_seed(){  list($usec, $sec) = explode(' ', microtime());  return $sec + $usec * 1000000;}srand(make_seed());$randval = rand();?>


    Output / Return Value


    Limitations


    Alternatives / See Also


    Reference