Namengen.
Dieses Script würfelt aus
Namen die in einer Textdatei stehen sollen ,neue Fantasienamen zusammen.
|
Script: |
$adj_array
= file("name1.txt");
$noun_array
= file("name2.txt");
$adj_array
= implode("",
$adj_array);
$adj_array
= explode(",",
$adj_array);
$noun_array
= implode("",
$noun_array);
$noun_array
= explode(",",
$noun_array);
// Random Seed initen
// seed with microseconds
function make_seed()
{
list($usec,$sec)
= explode("
", microtime());
return ((float)$sec+(float)$usec)
* 100000;
}
srand(make_seed());
$myrandomval =
rand(0,count($adj_array)-1);
// Random Seed initen 2
$myrandomval2 =
rand(0,count($noun_array)-1);
/*==
create name from random numbers ==*/
$name =
$adj_array[$myrandomval].$noun_array[$myrandomval2];
?>
|
|
|