Poor man's view of the world

This is a very simple php code for generating random numbers, alphabets etc. Two methods are illustrated in this code.

To see a working demo of this code, visit: http://www.rohasnagpal.com/projects/random

code

<?

function random_generator($digits)
    {
        srand ((double) microtime() * 10000000);
        $input = array ("A", "B", "C", "D", "E","F","G","H","I","J","K","L","M","N","O","P","Q", "R","S","T","U","V","W","X","Y","Z","a", "b", "c", "d", "e","f","g","h",
"i","j","k","l","m","n","o","p","q", "r","s","t","u","v","w","x","y","z");
        $random_generator="";
        for($i=1;$i<$digits+1;$i++)
            { 
                $rand_index = array_rand($input);
                $random_generator .=$input[$rand_index];
            } 

    return $random_generator;
} 

$random_alphabets=random_generator(10);

echo "Your 10 digit random alphabet string is:<br>";
echo "<b>" . $random_alphabets . "</b>";

echo "<p>";
$random_number=rand(1000000000, 9999999999);
echo "Your 10 digit random numeric string is:<br>";
echo "<b>" . $random_number . "</b>";
echo "<p>";

function random_pwd($length = 15) 
    {
            $valid_characters = "abcdefghijklmnopqrstuxyvwzABCDEFGHIJKLMNOPQRSTUXYVWZ+-*#&@!?1234567890";
            $valid_char_number = strlen($valid_characters);

            $result = "";

            for ($i = 0; $i < $length; $i++) 
            {
                $index = mt_rand(0, $valid_char_number - 1);
                $result .= $valid_characters[$index];
                }

            return $result;
        }

        $random_string = random_pwd();

echo "Your 15 digit random alpha-numeric-symbol string is:<br>";
echo "<b>" . $random_string . "</b>";

?>

To see a working demo of this code, visit: http://www.rohasnagpal.com/projects/random

The php code can also be downloaded from: http://www.rohasnagpal.com/projects/random/code.txt