C - Comparing an element in an array with all the previous ones
<p>I have a loop that generates random numbers. I want to compare the random number generated in the current iteration with random numbers generated in all the previous iterations and <code>break</code> when there is match between two random numbers.
This is what I have so far, but it only compares the current random number with the one that is generated right before it.</p>

<pre><code>for (i = 0; i &lt; SIZE; ++i)
{
    a[i] = (100*(1 + rand() % 12)) + (1 + rand() % 30);

    for (j = i - 1; j &lt; SIZE; ++j)
    {
        if (a[i] != a[j])
        {
            printf("Person %i - %i\n", i, a[i]);
        }
        else break; 
    }

}
</code></pre>