title: Random String of Certain Numbers and Letters - Only a certain number of times
body: <p><strong>Code:</strong></p>
  
  <pre><code>    public char[] numbers = new char[] { '3', '4', '5' };
      public char[] letters = new char[] { 'X', 'T', 'M', 'W', 'Y', 'L' };
  
      //Generate a String with only 2 of the above letters and the rest filled 
      //with the numbers the characters shouldn't be always next to one another
  </code></pre>
  
  <p>I looked at some of the other solutions:
              var random = new Random();</p>
  
  <pre><code>        for (int i=0; i&lt;50; i++)
          {
              var result = new string(
                  Enumerable.Repeat(chars, 8)
                            .Select(s =&gt; s[random.Next(s.Length)])
                            .ToArray());
          }
  </code></pre>
  
  <p>but they just generate random strings not from a smaller character set nor do they limit the number of letters versus number of numbers.</p>
  
  <p><strong>Examples:</strong>
  <strong><em>Valid</em></strong></p>
  
  <blockquote>
    <p>X333Y453 </p>
    
    <p>X3L45453 </p>
    
    <p>XL333333</p>
    
    <p>4L333X333 </p>
    
    <p>333L45L3</p>
  </blockquote>
  
  <p><strong><em>Invalid</em></strong></p>
  
  <blockquote>
    <p>5533Y453 </p>
    
    <p>333L45453 </p>
    
    <p>XL33L333 </p>
  </blockquote>
  
  <p>Can only have 2 characters and since there are 8 total characters there should be 6 numbers</p>