title: After creating a random javaScript-array with recurring integers - avoid identical integers side by side
body: <p>have anybody any suggestion to "deal" a array after filling it randomly with recurring integers?</p>
  
  <p>here is a easy example (3 x integer-group: 1,2,3,4):</p>
  
  <pre><code>array[1,2,3,4,4,2,3,1,1,4,3,2];
  </code></pre>
  
  <p>is there a way with a special function, to "<strong>rearrange</strong>" the array, by avoiding the same integers side by side.</p>
  
  <p>this would be OK (no immediate neighbor is identical):</p>
  
  <pre><code>array[1,2,1,2,1,3,4,3,4,3,4,2];
  </code></pre>
  
  <p>those are not:</p>
  
  <pre><code>array[4,4,4,1,2,3,3,2,1,1,2,3];
  array[1,2,3,2,1,3,3,4,4,1,2,4];
  </code></pre>
  
  <p>in my case the array could have 25 to 30 times the same integer-group.
  hopefully I'm declaring comprehensible - so, you understanding my problem!</p>
  
  <p>Thank you in advance for your efforts</p>
  
  <p>FerO</p>
  
  <p><strong>Edited for clarity:</strong></p>
  
  <p>All integers <strong>must be conserved</strong> (not deleted) and the integers could be <strong>between 0 and 99</strong>!</p>
  
  <p>changed "clean" to "rearrange"</p>