Jquery basic: How to randomize this array and still call all the parameters?
<p>I have 2 divs, <code>#col1</code> and <code>#col2</code>, that I need to generate some divs with fruit names in there.</p>

<p>So far I have:</p>

<pre><code>var fruitArray = ['apples','banana','orange','grapes'];
for (fruit in fruitArray) {
    $('&lt;div class="'+fruitArray[fruit]+'"&gt;&lt;/div&gt;').appendTo('#col1').doSomething(); 

    $('&lt;div id="'+fruitArray[fruit]+'"&gt;&lt;/div&gt;').appendTo('#col2').doSomething(); 
}
</code></pre>

<p>Which turns out like:</p>

<pre><code>&lt;div id="#col1"&gt;
    &lt;div class="apples"&gt;&lt;/div&gt;
    &lt;div class="banana"&gt;&lt;/div&gt;
    &lt;div class="orange"&gt;&lt;/div&gt;
    &lt;div class="grapes"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div id="#col2"&gt;
    &lt;div id="apples"&gt;&lt;/div&gt;
    &lt;div id="banana"&gt;&lt;/div&gt;
    &lt;div id="orange"&gt;&lt;/div&gt;
    &lt;div id="grapes"&gt;&lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>How do I randomize the array so it looks something like:</p>

<pre><code>&lt;div id="#col1"&gt;
    &lt;div class="orange"&gt;&lt;/div&gt;
    &lt;div class="apples"&gt;&lt;/div&gt;
    &lt;div class="orange"&gt;&lt;/div&gt;
    &lt;div class="grapes"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div id="#col2"&gt;
    &lt;div id="grapes"&gt;&lt;/div&gt;
    &lt;div id="orange"&gt;&lt;/div&gt;
    &lt;div id="apples"&gt;&lt;/div&gt;
    &lt;div id="banana"&gt;&lt;/div&gt;
&lt;/div&gt;
</code></pre>
