PHP Manual
Prev |  | Next

# srand

srand -- seed the random number generator

## Description

`void srand`(int seed);

Seeds the random number generator with `seed`.

      1
      2 // seed with microseconds since last "whole" second
      3 srand((double)microtime()*1000000);
      4 $randval = rand();
      5

See also rand(), getrandmax(), mt_rand(), mt_srand() and mt_getrandmax().

Prev | Home | Next
Sqrt | Up | Tan