title: how to generate unique ID character using letters a-z
body: <p>Here is a little challenge, I hope it will be useful for others too.</p>
  
  <p>Task is to obtain an ID character from alphabets of english language. a-to-z</p>
  
  <p>My solution currently allows ID (words) of 26 diff length (max possible). with 90 possible words.</p>
  
  <p>I know this can be increased if we pick random characters after single character IDs are obtained (done with.) (But) I am finding it hard to figure out how to manage NOT hitting a combination already found (ID has to be unique). As we see it takes a long time if it starts finding the same combinations over and over. this probability increases as we obtain more and more ID-combinations.</p>
  
  <p>Here is my code and fiddle to test and check:</p>
  
  <p><a href="https://jsfiddle.net/rp_fiddle/nanu1hr9/" rel="nofollow noreferrer">fiddle</a></p>
  
  <p>code:</p>
  
  <p>html</p>
  
  <pre><code>&lt;p&gt;
    start
  &lt;/p&gt;
  </code></pre>
  
  <p>jquery:</p>
  
  <pre><code> function addto(t) {
      $("p").append("&lt;b&gt;" + t + "&lt;/b&gt;");
    }
  
  global_ID_array = [];
  lowerAlpha = "abcdefghijklmnopqrstuvwxyz";
  var myIDlength = 1;
      function getIDChar (){
          do {
              var myIDchar = lowerAlpha.substr(0, myIDlength);
              lowerAlpha = lowerAlpha.replace(myIDchar,'');
              if (lowerAlpha.length &lt; myIDlength){
                  lowerAlpha = "abcdefghijklmnopqrstuvwxyz";      //reset
                  myIDlength++;
        }
          } while (global_ID_array.indexOf(myIDchar) &gt; -1)
          global_ID_array.push(myIDchar);
          addto(myIDlength+':'+global_ID_array.length+',');
      }
  
    do{
    getIDChar();
    }while (myIDlength &lt; 26);
    addto('&lt;br \&gt;myIDlength='+myIDlength);
    addto('&lt;br \&gt;global_ID_array last val='+global_ID_array[global_ID_array.length-1]+'&lt;p&gt;');
  </code></pre>