title: jquery multidimensional array shuffle random
body: <p>I want to minimize my code from:</p>
  
  <pre><code>myArrayA = [1, 2, 3, 4, 5];
  fisherYates(myArrayA);
  myArrayB = [6, 7, 8, 9, 10];
  fisherYates(myArrayB);
  myArrayC = [11, 12, 13, 14, 15];
  fisherYates(myArrayC);
  myArrayD = [16, 17, 18, 19, 20];
  fisherYates(myArrayD);
  myArrayE = [21, 22, 23, 24, 25];
  fisherYates(myArrayE);
  </code></pre>
  
  <p>To:</p>
  
  <pre><code>var multArr = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]];
  fisherYates(multArr);
  </code></pre>
  
  <p>The output I want is like this:</p>
  
  <pre><code>[4,2,3,5,1],[7,10,6,9,8],[11,15,12,14,13],[18,17,16,20,19],[22,21,25,23,24]
  </code></pre>
  
  <p>I tried this code:<br/>
  <a href="http://jsfiddle.net/arrow/yFn8U/" rel="nofollow">http://jsfiddle.net/arrow/yFn8U/</a><br/></p>
  
  <pre><code>function fisherYates(myArray) {
  var i = myArray.length, j, tempi, tempj;
  if (i === 0) return false;
  while (--i) {
      j = Math.floor(Math.random() * (i + 1));
      tempi = myArray[i];
      tempj = myArray[j];
      myArray[i] = tempj;
      myArray[j] = tempi;
  }
  }
  var multArr = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]];
  fisherYates(multArr);
  </code></pre>
  
  <p>But my code only randomizes the order of the chunks not the values in each chunk.<br/>
  The output I want is like this:</p>
  
  <pre><code>[4,2,3,5,1],[7,10,6,9,8],[11,15,12,14,13],[18,17,16,20,19],[22,21,25,23,24]
  </code></pre>
  
  <p>I want each chunk inside the array to be in the same order but each chunk must be randomized.<br/>
  Is there a way to do this with jQuery?<br/>
  I also wonder how to get values from the shuffled/randomized array?<br/>
  At the moment I get the values like this:</p>
  
  <pre><code>myArrayA[i]
  myArrayB[i]
  myArrayC[i]
  myArrayD[i]
  myArrayE[i]
  </code></pre>
  
  <p>I would guess I will get them with something like:</p>
  
  <pre><code>multArr [[0][i]];
  multArr [[1][i]];
  multArr [[2][i]];
  multArr [[3][i]];
  multArr [[4][i]];
  </code></pre>
  
  <p>Finally I wonder if minimizing the code will give better performance?</p>