Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
PHP srand() Function
Definition and Usage
The srand() function is used to seed the random number generaror. Seeding initializes the random number generator. Most random number generators need initial seeding. In PHP, use of srand() function is optional as it is done automatically.
This function doen't have any return value.
Syntax
srand ([ int $seed ] ) : void
Parameters
| Sr.No | Parameter & Description |
|---|---|
| 1 |
seed an integer to be used as seed. If not given, a random number is given |
Return Values
This function doesn't return any value.
PHP Version
This function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.
Example
<?php srand(time()); echo "rand()=", rand(); ?>
Output
This may produce following result−
rand()=548287992
Advertisements
