Java generating random numbers
<p>How would one get rid of repeat number in Java.</p>

<p>Say for example I made an array to store (10,000) random integer from 0 to 9999 how can I make sure the number do not repeat.</p>

<p>Any help is welcome.</p>

<p>this is what I did</p>

<pre><code>import java.util.Random;

public class Sort
{

    public static void main(String[] args)
    {
        //array to store 10000 random integers (0-9999)
        int[] nums = new int[10000];

        //note a single Random object is reused here
        Random randomGenerator = new Random();

        for (int i = 0; i &lt; nums.length; ++i)
        {
            //Generate our 10000 random numbers
            nums[i] = randomGenerator.nextInt(10000);
        }
    }
}
</code></pre>
