SQL PHP HTML ASP JavaScript articles and free scripts to download
 

Random number generator

We can generate random value by using PHP. We can specify a range and the random value between those two ranges (inclusive) will be generated.


Note that here we are generating a random number only. To get any random characters we can use arrays. The details on how to generate random characters is available here.


Here is the code to generate random numbers.



echo "<br>Random Value = ".rand(5,10);    
// Will display random value between 5 and 10 ( both inclusive )



Read here how to generate random string having alphabets and digits

Discuss this tutorial at forum


PHP Math Functions
PHP Math Functions  |Maximum and Minimum numbers  |PHP Round  | Random number generator  | NUmber Formatting  | Ceil and floor value of a number  | Modulus or reminder
 

Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.

Scripts
PHP
JavaScript
PHP Tutorial Index
Popular Tutorials
Drop down list
File Upload
Signup script
Member Login
Line Graph
PHP MySQL Paging
PHP Calendar
PHP Tutorials
PHP Introduction
Loops & structure
Array
Date & Time
Functions
Form Handling
File Handling
Math Functions
String Functions
GD Functions
Comment Posting
Content Management
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.