Rated an average of 4 stars by 2 people

Random Number in a Range

Script Details:
Added on July 29, 2007 by Zhay.
Zhay accreditted the script to himself.

Description:
This function returns a random number between an upper and lower boundary.

Tags: bound, boundary, ceiling, floor, generator, high, low, lower, number, random, range, upper

Code:

<?php
# Snippet from PHP Share: http://www.phpshare.org

// Returns a random number between two boundaries

if (!function_exists("randomNumber"))
{
    function 
randomNumber($floor$ceiling)
    {
        
srand((double) microtime() * 1000000);
        
        return 
rand($floor$ceiling);
    }
}
?>

Review this PHP Script:

Rating:

Comments:


Login

User:
Pass:

Register

Not a member? Register today and receive the many free benefits of being a member!

Advertisements