proc randomname {} { set res [lpick {"" B C D F G H J K L M N P QU R S T V W X Z}] append res [lpick {A E I O U}] append res [lpick {B C D F G H J K L M N P QU R S T V W X Z}] append res [lpick {A E I O U}] append res [lpick {"" B C D F G H J K L M N P QU R S T V W X Z}] append res [lpick {A E I O U}] append res [lpick {"" B C D F G H J K L M N P R S T V W X Z}] }#-- which uses this little helper:
proc lpick list {lindex $list [expr int(rand()*[llength $list])]}#--Example output:
% set n ""; for {set i 0} {$i<100} {incr i} {lappend n [randomname]} % set nHOFUKEN WEKOIB WIHUHAD ZADOLUW COLUBID PIQUEKOZ HIQUIZID REPUFA RUXACUX SUNIJUL CIKIZIS BUJUWUF DOSUIK LUQUUUX TOLUTUZ DUJASEX RUREROF LOKOLIF MULAOP QUOCEVO WOVASUC BADUOG SAQUUWAX DIHUHEP JUCIPUT BURERAC FATOGAJ BOWAZUL LOCEXET NITEPAB TUSINUB DIWABUR GURUNEW MAHOCEX LEQUOWIM HIMAQUAR LUKUNAP JACUVAX XENAMAT QUORUUH RATARIX VAKEDOW DOXEHUJ TITEKAS BUWUWIW HEGESOB VONAHUJ TUQUERES JUNELEJ MAWEMIF LEMEWAX VOBOVAZ JOBUTA POCAWUH DOQUEBAL SULIDIZ TAZULUR KUPAPEF XOGATUS ZAKIRIM ZESABEN VIPUVIH SAFAWAJ MUCEDEN NOZUGEM PUCATIH POZAVIG VOPIUV EKIIR GICASOB KEQUUGIF WUTEGIT CASOXOG MAWEPES VOBIFAP BAKIFUX BOWOPAS SUMUNIN JABICUK TAJAKAT HOWARIK VORAXED FAWAPUP SIFEGIB HOTAKUB MADEWOC MUBUMOB ZIHUZAF WIXOEM KIFERIN FIQUIFOL QUINEVOX JOXESOH WIMONA LILOTUM HOTIBES RISUZIT DOWUHOZ RODIBOT LUTUZALSome fine-tuning may be advisable to avoid consonant duplication...slebetman: Applying similar principles, here's a more involved version:
proc randomname {{maxlen 10}} { set consonants {B C D F G H J K L M N P QU R S T V W X Z} set vowels {A E I O U} set x [lpick {0 1}] set res "" for {set n [expr {int(rand()*($maxlen-3))+3}]} {$n} {incr n -1} { if {$n%2 == $x} { append res [lpick $vowels] } else { append res [lpick $consonants] } } return $res }
gold added pix
Arts and crafts of Tcl-Tk programming