Selecting rows from IEnumerable based on a percentage
<p>I currently have a windows service that runs every 5 minutes. The code selects rows from a database for processing. There is a cap (maximum rows allowed to be selected) so the number of rows selected could be anywhere from 0-100.</p>

<p>I am looking to do some processing on these rows based on a random percentage selection.</p>

<ul>
<li>Task 1 25%</li>
<li>Task 2 50%</li>
<li>Task 3 100%</li>
</ul>

<p>For simplicity, let's assume the service selects 100 rows, then 25 randomly selected rows will run Task 1, 50 randomly selected rows will run Task 2, and all of the rows will run Task 3.</p>

<p>The code I have currently looks something like:</p>

<pre><code>var rows = repository.GetRows(100);

foreach(var row in rows)
{
    task1.Run(row);
    task2.Run(row);
    task3.Run(row);
}
</code></pre>

<p>This will run all three tasks on all rows. How would I go about only selecting the allotted percentages to each task?</p>
