title: Get the most average position of X objects on a path with Y available positions
body: <p>Its friday, and in local time the clock is 3.22pm, so my brain wont give me a solution, so i ask:</p>
  
  <p>Im trying to write a function/algorithm in Actionscript 3.0 that gives me the most average positions of x number of positions along a path of y number of available positions.</p>
  
  <p>Y is always larger than X of course.</p>
  
  <p>The background is, I got a map, with for example 50 possible placements of objects (along a path). But i only got 32 objects to place along this path, but i want their placements to be as average/even along that path as possible. So that it for example won't be a big gap at the end. My avaiable positions are at the moment stored in an array with point values.</p>
  
  <p>If you just do totalPos/wantedPos and floor it, it will be a "ugly" gap at the end, any ideas?</p>
  
  <p>EDIT:</p>
  
  <p>I wanted to add the function incase anyone else wants it:</p>
  
  <pre><code>function place (x : uint, y : uint ) : Array
  {
      var a : Array = new Array();
      var s : Number = y / x;
      var c : Number = 0;
  
      for (var i : Number = 0; i&lt;x; i++) {
          c++;
          var pos : Number = Math.round(i * s);
          a.push(posArray[pos]);
      }
      return a;
  }
  </code></pre>
  
  <p>Assumes you have an array posArray with the possible positions already...</p>