title: Sort array of numbers by normal distribution (gaussian distribution)
body: <p>Having an array of numbers <code>setOfNumbers = [0, 3, 3, 2, 7, 1, -2, 9]</code> I'd like to sort this set to have the smallest numbers on the end and beginning and the biggest in the center of the sorted set like this <code>sortedSetNumbers = [0, 2, 3, 9, 7, 3, 1, -2]</code>.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const setOfNumbers = [0, 3, 3, 2, 7, 1, -2, 9];
  const result = [0, 2, 3, 9, 7, 3, 1, -2];
  
  function sortNormal(a, b) {
    return true; // Please, change this line
  }
  
  const sortedSetNumbers = setOfNumbers.sort((a, b) =&gt; sortNormal(a, b));
  
  
  
  if (sortedSetNumbers === result) {
    console.info('Succeeded Normal Distributed');
  } else {
    console.warn('Failed Normal Distribution');
  }
  
  console.log(sortedSetNumbers);</code></pre>
  </div>
  </div>
  </p>
  
  <p>I am sure it is possible to sort these numbers with the method <code>Array.prototype.sort()</code>, but how should this sorting function look like?</p>
  
  <p><strong>EDIT:</strong> The solution does not have to be solved with <code>.sort()</code>. That was only an idea.</p>