Thursday, 8 August 2013

How many unique jsbin url shortcode combinations can exist?

How many unique jsbin url shortcode combinations can exist?

This is jsbin's function that generates each bin's identification shortcode:
function shortcode() {
var vowels = 'aeiou',
consonants = 'bcdfghjklmnpqrstvwxyz',
word = '', length = 6, index = 0, set;
for (; index < length; index += 1) {
set = (index % 2 === 0) ? vowels : consonants;
word += set[Math.floor(Math.random() * set.length)];
}
return word;
}
How many different combinations could it produce? If I've calculated well,
there are 3.08915776e+8 combinations when using 6 letters from a set of 26
letters(a-z). But how would this be calculated, since there are sets of
5(vowels) and sets of 21(consonants) alternating to produce memorizable
shortcodes like 'ecamit', 'izafij', 'erowih', 'avimog' etc...

No comments:

Post a Comment