{"id":1784,"date":"2012-10-17T21:52:41","date_gmt":"2012-10-17T19:52:41","guid":{"rendered":"http:\/\/planetozh.com\/blog\/?p=1784"},"modified":"2012-10-17T21:55:23","modified_gmt":"2012-10-17T19:55:23","slug":"generate-random-pronouceable-words","status":"publish","type":"post","link":"https:\/\/planetozh.com\/blog\/2012\/10\/generate-random-pronouceable-words\/","title":{"rendered":"Generate Random Pronouceable Words"},"content":{"rendered":"<p>Ho ha\u00ef, blog, long time no see! :)<\/p>\n<p>I was checking stuff on various URL shorteners and noticed <a href=\"http:\/\/is.gd\/\">is.gd<\/a> has one interesting feature: you can generate short URLs that are &quot;pronounceable&quot; (no &quot;vgfhgt&quot;). This is a great little touch: a random but pronounceable word will be more memorable and the probability for typos is reduced, which makes it a killer feature for random generated passwords for example.<\/p>\n<p>Generating pronounceable random words isn&#39;t difficult :<\/p>\n<ul>\n<li>start by a vowel or a consonant<\/li>\n<li>alternate and add letters till proper word length<\/li>\n<\/ul>\n<p>Simple, but this generates words that are <em>too simple<\/em> maybe: &#39;abuco&#39;, &#39;misolo&#39;, &#39;xulanipo&#39;, etc&#8230; Natural words also use a few consecutive consonant combinations as well as vowel combos (&#39;cheepo&#39;, &#39;bergam&#39;, &#8230;)<\/p>\n<p>I ended up with this simple piece of code that gives more natural words:<\/p>\n<div id=\"ig-sh-1\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">php<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"php\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #000000;font-weight: bold\">&lt;?php<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009933;font-style: italic\">\/**<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009933;font-style: italic\">&nbsp;* Generate random pronounceable words<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009933;font-style: italic\">&nbsp;*<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009933;font-style: italic\">&nbsp;* @param int $length Word length<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009933;font-style: italic\">&nbsp;* @return string Random word<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009933;font-style: italic\">&nbsp;*\/<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #000000;font-weight: bold\">function<\/span> random_pronounceable_word<span style=\"color: #009900\">&#040;<\/span> <span style=\"color: #000088\">$length<\/span> <span style=\"color: #339933\">=<\/span> <span style=\"color: #cc66cc\">6<\/span> <span style=\"color: #009900\">&#041;<\/span> <span style=\"color: #009900\">&#123;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color: #666666;font-style: italic\">\/\/ consonant sounds<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color: #000088\">$cons<\/span> <span style=\"color: #339933\">=<\/span> <span style=\"color: #990000\">array<\/span><span style=\"color: #009900\">&#040;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #666666;font-style: italic\">\/\/ single consonants. Beware of Q, it's often awkward in words<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff\">'b'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'c'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'d'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'f'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'g'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'h'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'j'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'k'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'l'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'m'<\/span><span style=\"color: #339933\">,<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff\">'n'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'p'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'r'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'s'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'t'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'v'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'w'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'x'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'z'<\/span><span style=\"color: #339933\">,<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #666666;font-style: italic\">\/\/ possible combinations excluding those which cannot start a word<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff\">'pt'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'gl'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'gr'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'ch'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'ph'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'ps'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'sh'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'st'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'th'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'wh'<\/span><span style=\"color: #339933\">,<\/span> <\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color: #009900\">&#041;<\/span><span style=\"color: #339933\">;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color: #666666;font-style: italic\">\/\/ consonant combinations that cannot start a word<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color: #000088\">$cons_cant_start<\/span> <span style=\"color: #339933\">=<\/span> <span style=\"color: #990000\">array<\/span><span style=\"color: #009900\">&#040;<\/span> <\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff\">'ck'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'cm'<\/span><span style=\"color: #339933\">,<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff\">'dr'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'ds'<\/span><span style=\"color: #339933\">,<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff\">'ft'<\/span><span style=\"color: #339933\">,<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff\">'gh'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'gn'<\/span><span style=\"color: #339933\">,<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff\">'kr'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'ks'<\/span><span style=\"color: #339933\">,<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff\">'ls'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'lt'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'lr'<\/span><span style=\"color: #339933\">,<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff\">'mp'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'mt'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'ms'<\/span><span style=\"color: #339933\">,<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff\">'ng'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'ns'<\/span><span style=\"color: #339933\">,<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff\">'rd'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'rg'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'rs'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'rt'<\/span><span style=\"color: #339933\">,<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff\">'ss'<\/span><span style=\"color: #339933\">,<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff\">'ts'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'tch'<\/span><span style=\"color: #339933\">,<\/span> <\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color: #009900\">&#041;<\/span><span style=\"color: #339933\">;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color: #666666;font-style: italic\">\/\/ wovels<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color: #000088\">$vows<\/span> <span style=\"color: #339933\">=<\/span> <span style=\"color: #990000\">array<\/span><span style=\"color: #009900\">&#040;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #666666;font-style: italic\">\/\/ single vowels<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff\">'a'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'e'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'i'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'o'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'u'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'y'<\/span><span style=\"color: #339933\">,<\/span> <\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #666666;font-style: italic\">\/\/ vowel combinations your language allows<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff\">'ee'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'oa'<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #0000ff\">'oo'<\/span><span style=\"color: #339933\">,<\/span> <\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color: #009900\">&#041;<\/span><span style=\"color: #339933\">;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color: #666666;font-style: italic\">\/\/ start by vowel or consonant ?<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color: #000088\">$current<\/span> <span style=\"color: #339933\">=<\/span> <span style=\"color: #009900\">&#040;<\/span> <span style=\"color: #990000\">mt_rand<\/span><span style=\"color: #009900\">&#040;<\/span> <span style=\"color: #cc66cc\">0<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #cc66cc\">1<\/span> <span style=\"color: #009900\">&#041;<\/span> <span style=\"color: #339933\">==<\/span> <span style=\"color: #0000ff\">'0'<\/span> ? <span style=\"color: #0000ff\">'cons'<\/span> <span style=\"color: #339933\">:<\/span> <span style=\"color: #0000ff\">'vows'<\/span> <span style=\"color: #009900\">&#041;<\/span><span style=\"color: #339933\">;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color: #000088\">$word<\/span> <span style=\"color: #339933\">=<\/span> <span style=\"color: #0000ff\">''<\/span><span style=\"color: #339933\">;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color: #b1b100\">while<\/span><span style=\"color: #009900\">&#040;<\/span> <span style=\"color: #990000\">strlen<\/span><span style=\"color: #009900\">&#040;<\/span> <span style=\"color: #000088\">$word<\/span> <span style=\"color: #009900\">&#041;<\/span> <span style=\"color: #339933\">&lt;<\/span> <span style=\"color: #000088\">$length<\/span> <span style=\"color: #009900\">&#041;<\/span> <span style=\"color: #009900\">&#123;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #666666;font-style: italic\">\/\/ After first letter, use all consonant combos<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #b1b100\">if<\/span><span style=\"color: #009900\">&#040;<\/span> <span style=\"color: #990000\">strlen<\/span><span style=\"color: #009900\">&#040;<\/span> <span style=\"color: #000088\">$word<\/span> <span style=\"color: #009900\">&#041;<\/span> <span style=\"color: #339933\">==<\/span> <span style=\"color: #cc66cc\">2<\/span> <span style=\"color: #009900\">&#041;<\/span> <\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #000088\">$cons<\/span> <span style=\"color: #339933\">=<\/span> <span style=\"color: #990000\">array_merge<\/span><span style=\"color: #009900\">&#040;<\/span> <span style=\"color: #000088\">$cons<\/span><span style=\"color: #339933\">,<\/span> <span style=\"color: #000088\">$cons_cant_start<\/span> <span style=\"color: #009900\">&#041;<\/span><span style=\"color: #339933\">;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"color: #666666;font-style: italic\">\/\/ random sign from either $cons or $vows<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #000088\">$rnd<\/span> <span style=\"color: #339933\">=<\/span> $<span style=\"color: #009900\">&#123;<\/span><span style=\"color: #000088\">$current<\/span><span style=\"color: #009900\">&#125;<\/span><span style=\"color: #339933\">&amp;<\/span><span style=\"color: #666666;font-style: italic\">#91; mt_rand( 0, count( ${$current} ) -1 ) &amp;#93;;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #666666;font-style: italic\">\/\/ check if random sign fits in word length<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #b1b100\">if<\/span><span style=\"color: #009900\">&#040;<\/span> <span style=\"color: #990000\">strlen<\/span><span style=\"color: #009900\">&#040;<\/span> <span style=\"color: #000088\">$word<\/span> <span style=\"color: #339933\">.<\/span> <span style=\"color: #000088\">$rnd<\/span> <span style=\"color: #009900\">&#041;<\/span> <span style=\"color: #339933\">&lt;=<\/span> <span style=\"color: #000088\">$length<\/span> <span style=\"color: #009900\">&#041;<\/span> <span style=\"color: #009900\">&#123;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #000088\">$word<\/span> <span style=\"color: #339933\">.=<\/span> <span style=\"color: #000088\">$rnd<\/span><span style=\"color: #339933\">;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #666666;font-style: italic\">\/\/ alternate sounds<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #000088\">$current<\/span> <span style=\"color: #339933\">=<\/span> <span style=\"color: #009900\">&#040;<\/span> <span style=\"color: #000088\">$current<\/span> <span style=\"color: #339933\">==<\/span> <span style=\"color: #0000ff\">'cons'<\/span> ? <span style=\"color: #0000ff\">'vows'<\/span> <span style=\"color: #339933\">:<\/span> <span style=\"color: #0000ff\">'cons'<\/span> <span style=\"color: #009900\">&#041;<\/span><span style=\"color: #339933\">;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #009900\">&#125;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color: #009900\">&#125;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp; &nbsp; <span style=\"color: #b1b100\">return<\/span> <span style=\"color: #000088\">$word<\/span><span style=\"color: #339933\">;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #009900\">&#125;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">&nbsp;<\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #000000;font-weight: bold\">?&gt;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>(bleh, just noticed the <del datetime=\"2012-10-17T19:52:58+00:00\">fucking<\/del>fancy curled quoted are back in code blocks. <a href=\"http:\/\/pastebin.com\/hvi658Qp\">pastebin<\/a> for cut&#39;n&#39;paste code)<\/p>\n<p>Play with the demo: <a href=\"http:\/\/planetozh.com\/projects\/random-pronounceable-words\/\">random pronounceable words<\/a>.<\/p>\n<p>Nothing elaborated enough to help you create an alien language for your next sci-fi movie, but I&#39;m rather pleased with the random words it creates. It&#39;s also easy to implement this in another language: modify the group of consecutive vowels and consonants to match what exists in your language.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ho ha\u00ef, blog, long time no see! :) I was checking stuff on various URL shorteners and noticed is.gd has one interesting feature: you can generate short URLs that are &quot;pronounceable&quot; (no &quot;vgfhgt&quot;). This is a great little touch: a random but pronounceable word will be more memorable and the probability for typos is reduced, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[2,393,10,392],"class_list":["post-1784","post","type-post","status-publish","format-standard","hentry","category-published","tag-code","tag-password","tag-php","tag-random"],"_links":{"self":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/1784","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/comments?post=1784"}],"version-history":[{"count":0,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/1784\/revisions"}],"wp:attachment":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/media?parent=1784"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/categories?post=1784"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/tags?post=1784"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}