title: Example of very CPU-intensive C function under 5 lines of code
body: <p>I'm testing a progress indicator in my program, so I'd like to test it against a function that takes a noticeable amount of time (i.e. >5 seconds) to finish.</p>
  
  <p>I tried this: </p>
  
  <pre><code>void doLotsOfWork () {
      for (int i = 0; i &lt; 100; i++) {
          arc4random()%(int)HUGE;
      }
  }
  </code></pre>
  
  <p>But this runs in under 1 second on my i7. Can you suggest even more CPU-intensive operations? The function body should really be no more than 5 lines of code. </p>