title: Round robin algorithm in a loop
body: <p>How round-robin algorithm can be implemented that runs in a loop for ever?</p>
  
  <pre><code>for (int i = 0; ;i++){
      roundRobinIndex = i % numberOfWorkers;
  }
  </code></pre>
  
  <p>The problems with the way above is that <code>integer overflow</code> problem. It can also be implemented with checking the value of <code>i</code>:</p>
  
  <pre><code>for (int i = 0; ;i++){
      roundRobinIndex = i % numberOfWorkers;
      if i == maxNumber{
          i = 0;
      }
  }
  </code></pre>
  
  <p>But this way seems ugly. Maybe there is more elegant way?</p>