title: generate random String that must Contains alphabets, number and Special Character (6-10 digits)
body: <p>I am generating a password which will have 6 to 10 digit. </p>
  
  <p>This is my code which gives me random password of 6-10 digit,</p>
  
  <pre><code>val AB = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:&lt;=&gt;?@_!#%&amp;()*+,-.~";
  val rnd = new Random();
  
  def randomPassword(): String = {
      val len = rnd.nextInt(5) + 5
      val sb = new StringBuilder(len);
      for (i &lt;- 0 to len)
         sb.append(AB.charAt(rnd.nextInt(AB.length())));
      return sb.toString();
      }
  </code></pre>
  
  <p>It works fine but the problem is that <strong><em>sometimes it gives all numbers or alphabets</em></strong>.</p>
  
  <p>I want the combination of alphabets and number and special character every time. any suggestion?</p>