function devel_generate_word in Devel 5
Same name and namespace in other branches
- 6 devel_generate.inc \devel_generate_word()
- 7 devel_generate/devel_generate.inc \devel_generate_word()
3 calls to devel_generate_word()
- devel_create_users in ./
devel_generate.inc - Generate some random users.
- devel_generate_terms in ./
devel_generate.inc - devel_generate_vocabs in ./
devel_generate.inc
File
- ./
devel_generate.inc, line 264
Code
function devel_generate_word($length) {
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);
while (strlen($word) < $length) {
$word .= $cons[rand(0, $num_cons - 1)] . $vowels[rand(0, $num_vowels - 1)];
}
return substr($word, 0, $length);
}