function devel_generate_word in Devel 7
Same name and namespace in other branches
- 5 devel_generate.inc \devel_generate_word()
- 6 devel_generate.inc \devel_generate_word()
5 calls to devel_generate_word()
- devel_create_users in devel_generate/
devel_generate.inc - Generate some random users.
- devel_generate_links in devel_generate/
devel_generate.inc - Generates menu links in a tree structure.
- devel_generate_menus in devel_generate/
devel_generate.inc - Generates new menus.
- devel_generate_terms in devel_generate/
devel_generate.inc - Generates taxonomy terms for a list of given vocabularies.
- devel_generate_vocabs in devel_generate/
devel_generate.inc
File
- devel_generate/
devel_generate.inc, line 463
Code
function devel_generate_word($length) {
mt_srand((double) microtime() * 1000000);
$vowels = array(
"a",
"e",
"i",
"o",
"u",
);
$cons = array(
"b",
"c",
"d",
"g",
"h",
"j",
"k",
"l",
"m",
"n",
"p",
"r",
"s",
"t",
"u",
"v",
"w",
"tr",
"cr",
"br",
"fr",
"th",
"dr",
"ch",
"ph",
"wr",
"st",
"sp",
"sw",
"pr",
"sl",
"cl",
"sh",
);
$num_vowels = count($vowels);
$num_cons = count($cons);
$word = '';
while (strlen($word) < $length) {
$word .= $cons[mt_rand(0, $num_cons - 1)] . $vowels[mt_rand(0, $num_vowels - 1)];
}
return substr($word, 0, $length);
}