title: Distribute integer value among the list values
body: <p>I have an input and I want to modify the existing list values based on the input distribution with the following logic.</p>
  
  <pre><code>int distributeVal = 7;
  List&lt;int&gt; validationList = new List&lt;int&gt;();
  </code></pre>
  
  <p>distributeVal can be any integer and should be distribute equally among the validationList.
  Few cases :</p>
  
  <pre><code>distributeVal               validationList               validationList(Updated)
     7                           {5,5,5}                     {5,2}
     7                           {5,6,5}                     {5,2}
     7                           {6,5,5}                     {6,1}
     8                           {2,2,2,3}                   {2,2,2,2}
     8                           {1}                         {1}    (remaining 7 ignored)
     8                           {5,2,7}                     {5,2,1}
     2                           {5,5,5}                     {2}
     3                           {1,1,5}                     {1,1,1}
     8                           {1,45,16}                   {1,7}
     0                           {1,50,50}                   {}
  </code></pre>
  
  <p>The allocation of validationList should be based on FCFS basis based on it's allowed list value.
  I tried doing this but with a lot of loops and conditions by dividing the distributeVal based on list values and then modifying it. How can I achieve this in best possible way? Thanks.</p>