Generate 7 random letters into 7 form fields
<p>I am in need to generate 1 random letter into 7 form fields. An example of the fields would look like below.</p>

<p>The letters can repeat, but only based on the letter and an amount of times that letter can repeat</p>

<p>For instance</p>

<ul>
<li>a x 7 (a can repeat only 7 times)</li>
<li>b x 5 (b can repeat only 5 times)</li>
<li>c x 2 (c can repeat only 2 times)</li>
</ul>

<p>and so on</p>

<pre><code>&lt;input type="text" name="1" maxlength="1" /&gt;
&lt;input type="text" name="2" maxlength="1" /&gt;
&lt;input type="text" name="3" maxlength="1" /&gt;
&lt;input type="text" name="4" maxlength="1" /&gt;
&lt;input type="text" name="5" maxlength="1" /&gt;
&lt;input type="text" name="6" maxlength="1" /&gt;
&lt;input type="text" name="7" maxlength="1" /&gt;
</code></pre>

<p>So far I have</p>

<pre><code>&lt;script language="javascript" type="text/javascript"&gt;
function randomString() {
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ";
var string_length = 1;
var randomstring = '';
for (var i=0; i&lt;string_length; i++) {
    var rnum = Math.floor(Math.random() * chars.length);
    randomstring += chars.substring(rnum,rnum+1);
}
document.randform.randomfield.value = randomstring;
}
&lt;/script&gt;
</code></pre>

<p>Im a little lost because this will only place it in one field. I am not sure how to optimize my javascript so that it can generate all the letters (1 into each field) AND make sure the letters dont repeat beyond what they are allowed too.</p>

<p>Any ideas?</p>
