title: Convert multiple percentages to fit into 100%
body: <p>I basically have a script that populates an area in a game, You can add multiple objects to populate the area and they all have a spawn Chance value from 0.00 - 1.00 attached. </p>
  
  <p>I'm trying to convert those spawn chances to fit into 100%, so that 3 objects with with 1.00 will convert to 0.33% or 3 objects with 50% will also convert to 0.33%. Or lastly, 3 objects with: 0.4, 0.4, 0.2 - Will convert to: 40, 40, 20 (I hope thats right).</p>
  
  <p>I'm trying, probably in the wrong direction, this at the moment:</p>
  
  <pre><code>void GetRanges()
  {
      for (int i = 0; i &lt; clutterObjects.Length; i++)
      {
          temp += clutterObjects[i].spawnChance;
      }
  
      if (temp &gt; 1.0)
      {
          temp = temp - 1.0f;
  
          for (int i = 0; i &lt; clutterObjects.Length; i++)
          {
              clutterObjects[i].spawnChance -= 
                  clutterObjects[i].spawnChance * temp;
          }
      }
      else
      {
          temp = Mathf.Abs(temp - 1.0f);
          for (int i = 0; i &lt; clutterObjects.Length; i++)
          {
              clutterObjects[i].spawnChance += 
                  clutterObjects[i].spawnChance * temp;
          }
      }
  
      Spawn();
  }
  </code></pre>
  
  <p>Anyone know how to go about this, Or what a better solution may be.</p>