Skip to content

Instantly share code, notes, and snippets.

@laughinghan
Last active March 26, 2016 05:56
Show Gist options
  • Save laughinghan/72826809f596da6e8be4 to your computer and use it in GitHub Desktop.
Save laughinghan/72826809f596da6e8be4 to your computer and use it in GitHub Desktop.

Playing around with pronounceable random strings, a la jsbin and hastebin's bin names.

conclusions

simpler is better, just have alternating one-letter consonants and vowels for a total of 3 syllables, like kipamif, for 25 bits of entropy

digraphs worsen memorability because there's so many of them they usually dominate the word making the word much longer and harder to read, pronounce, memorize; best compromise with digraphs is 2-syllable words which still only have 25 bits and yet are slightly less memorable

scratch

started from this code: http://stackoverflow.com/q/18134555/362030

24*8*24*8*24
884736
Math.log2(24*8*24*8*24)
19.75488750216347
Math.log2(24*8*24*8*24*8*24)
27.339850002884624
Math.log2(Math.pow(24,4))+Math.log2(Math.pow(8,3))
27.339850002884624
Math.log2(Math.pow(24,4))+Math.log2(Math.pow(9,3))
27.84962500721156
Math.log2(Math.pow(25,4))+Math.log2(Math.pow(8,3))
27.575424759098897
Math.log2(Math.pow(24,4))+Math.log2(Math.pow(8,3))
27.339850002884624
Math.log2(Math.pow(24,4))+Math.log2(Math.pow(8,3))
27.339850002884624
'ch ph sh sk sm sp st th'.split(' ')
["ch", "ph", "sh", "sk", "sm", "sp", "st", "th"]
'ch ph sh sk sm sp st th'.split(' ').length
8
'ch ph sh sk sm sp st th'.split(' ').length + 21
29
'ch ph sh sk sm sp st th'.split(' ').length + 20
28
Math.log2(Math.pow(24,4))+Math.log2(Math.pow(9,3))
27.84962500721156
Math.log2(Math.pow(28,4))+Math.log2(Math.pow(9,3))
28.73919469255735
(Math.log2(Math.pow(28,4))+Math.log2(Math.pow(9,3)))*4
114.9567787702294
Math.log2(Math.pow(28,4))+Math.log2(Math.pow(9,3))
28.73919469255735
Math.log2(Math.pow(28,3))+Math.log2(Math.pow(9,3))
23.93183977049975
'bl, br, ch, ck, cl, cr, dr, fl, fr, gh, gl, gr, ng, ph, pl, pr, qu, sc, sh, sk, sl, sm, sn, sp, st, sw, th, tr, tw, wh, wr, sch, scr, shr, spl, spr, squ, str, thr'.split(', ').join('\n').length
124
Math.log2(124*Math.pow(28,3))+Math.log2(Math.pow(9,3))
30.886036080886623
Math.log2(28*Math.pow(124,3))+Math.log2(Math.pow(9,3))
35.17971885754517
120/35
3.4285714285714284
35*3
105
function mkWord(){var word='';index=0;    for (; index < length; index += 1) {
        set = (index % 2 === 1) ? vowels : consonants;
        word += set[Math.floor(Math.random() * set.length)];
    }
return word}
undefined
var set;
undefined
var vowels = [].slice('aeiouy').concat('ee oo oi'.split(' '))
undefined
var consonants = [].slice('bcdfghjklmnpqrstvwxz').concat('ch ph sh sk sm sp st th'.split(' '))
undefined
consonants.length
8
var consonants = [].slice.call('bcdfghjklmnpqrstvwxz').concat('ch ph sh sk sm sp st th'.split(' '))
undefined
var vowels = [].slice.call('aeiouy').concat('ee oo oi'.split(' '))
undefined
vowels
["a", "e", "i", "o", "u", "y", "ee", "oo", "oi"]
consonants
["b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "z", "ch", "ph", "sh", "sk", "sm", "sp", "st", "th"]
'bl, br, ch, ck, cl, cr, dr, fl, fr, gh, gl, gr, ng, ph, pl, pr, qu, sc, sh, sk, sl, sm, sn, sp, st, sw, th, tr, tw, wh, wr, sch, scr, shr, spl, spr, squ, str, thr'.split(', ')
["bl", "br", "ch", "ck", "cl", "cr", "dr", "fl", "fr", "gh", "gl", "gr", "ng", "ph", "pl", "pr", "qu", "sc", "sh", "sk", "sl", "sm", "sn", "sp", "st", "sw", "th", "tr", "tw", "wh", "wr", "sch", "scr", "shr", "spl", "spr", "squ", "str", "thr"]
var initCons = 'bl, br, ch, ck, cl, cr, dr, fl, fr, gh, gl, gr, ng, ph, pl, pr, qu, sc, sh, sk, sl, sm, sn, sp, st, sw, th, tr, tw, wh, wr, sch, scr, shr, spl, spr, squ, str, thr'.split(', ')
undefined
var length = 6;
undefined
function mkWord(){var word=initCons[Math.floor(Math.random() * initCons.length)];index=0;    for (; index < length; index += 1) {
        set = (index % 2 === 0) ? vowels : consonants;
        word += set[Math.floor(Math.random() * set.length)];
    }
return word}
undefined
mkWord()
"swoigispoom"
mkWord()
"cluzoozasm"
mkWord()
"pladuthoom"
mkWord()
"cloiveneet"
mkWord()
"sprajoohesm"

We can see here that even with only limited vowel and consonant digraphs and trigraphs, 3 syllables is too much to be reliably memorable (swoigispoom is pretty hard to remember)

Math.log2(124*Math.pow(28,2))+Math.log2(Math.pow(9,2))
22.90875615738671
mkWord()
"scizuhoir"
mkWord()
"dryskofoost"
mkWord()
"sceegoiphew"
length=4
4
mkWord()
"sloohed"
mkWord()
"quustoip"
mkWord()
"twochoish"
mkWord()
"gryjoob"
mkWord()
"snyjesh"
mkWord()
"stoipyb"
mkWord()
"broitheev"
length=6
6
length=6
6
mkWord()
"preenakask"
mkWord()
"breezybask"
mkWord()
"clospyspeesp"
length=4
4
mkWord()
"croociph"
mkWord()
"skedad"
mkWord()
"prooveer"
mkWord()
"crovoop"
mkWord()
"wreespaq"
mkWord()
"spomar"
mkWord()
"skuskoop"
mkWord()
"smejyh"
mkWord()
"stenosh"
mkWord()
"sploizeb"
mkWord()
"drofut"
mkWord()
"frisiz"
Math.log2(124*Math.pow(28,2))+Math.log2(Math.pow(9,2))
22.90875615738671
Math.log2(Math.pow(20,4))+Math.log2(Math.pow(6,3))
25.042599881712917
function mkWord(){var word='';index=0;    for (; index < length; index += 1) {
        set = (index % 2 === 1) ? vowels : consonants;
        word += set[Math.floor(Math.random() * set.length)];
    }
return word}
undefined
length=6
6
mkWord()
"chibeeju"
vowels = 'aeiouy'
"aeiouy"
consonants = 'bcdfghjklmnpqrstvwxz'
"bcdfghjklmnpqrstvwxz"
consonents.length + vowels.length
VM6390:2 Uncaught ReferenceError: consonents is not defined(…)(anonymous function) @ VM6390:2InjectedScript._evaluateOn @ VM4636:875InjectedScript._evaluateAndWrap @ VM4636:808InjectedScript.evaluate @ VM4636:664
consonants.length + vowels.length
26
mkWord()
"sabawe"
length = 7
7
mkWord()
"nujaveq"
mkWord()
"delawoz"
mkWord()
"vamixoc"
mkWord()
"desunut"
5*25
125
mkWord() + '-' + mkWord()
"zeqases-fyvuzog"
Math.log2(Math.pow(20,4))+Math.log2(Math.pow(6,3))
25.042599881712917
Math.log2(Math.pow(21,4))+Math.log2(Math.pow(5,3))
24.53505397577713
mkWord() + '-' + mkWord()
"tivemaf-ziciwex"
mkWord() + '-' + mkWord()
"poligat-fexabaj"
Math.log2(124*Math.pow(28,2))+Math.log2(Math.pow(9,2))
22.90875615738671
Math.log2(Math.pow(124,2)*28)+Math.log2(Math.pow(9,2))
25.05559754571598

So to get the same entropy as a 3-syllable no-digraphs word with a 2-syllable allow-digraphs word requires the extra di/trigraphs in both the first and second consonant, so they'll be there all the time since there's so many of them, so they'll be super unpronounceable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment