note 35329 deleted from function.rand by aidan
| From: | aidan@php.net | Date: | Sat, 10 Jul 2004 02:37:45 +0000 |
| Subject: | note 35329 deleted from function.rand by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72974@lists.php.net to get a copy of this message | ||
Note Submitter: breakzero@hotmail.com
----
Here is a Simple Funcion that Generates a Random Name String that is somewhat readable.
$Name[$x] = ucfirst (RandomName(rand(5,8)));
function RandomName( $nameLength )
{
$NameChars = 'abcdefghijklmnopqrstuvwxyz';
$Vouel = 'aeiou';
$Name = "";
for ($index = 1; $index <= $nameLength; $index++)
{
if ($index % 3 == 0)
{
$randomNumber = rand(1,strlen($Vouel));
$Name .= substr($Vouel,$randomNumber-1,1);
}else
{
$randomNumber = rand(1,strlen($NameChars));
$Name .= substr($NameChars,$randomNumber-1,1);
}
}
return $Name;
}